scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit ddef1973a8abfceb690a1654fca690316d1cadb5
parent f4d94c9412b2bb75ae9cbf69bce84876065ff42d
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Tue, 29 Mar 2022 16:28:06 +0200

libc: Readjust freep realloc() modifies the free list

Freep can be pointing to the block that is modified by
realloc(), so it is needed to set freep to some valid
value (the actual value is not important).

Diffstat:
Msrc/libc/stdlib/realloc.c | 1+
1 file changed, 1 insertion(+), 0 deletions(-)

diff --git a/src/libc/stdlib/realloc.c b/src/libc/stdlib/realloc.c @@ -45,6 +45,7 @@ realloc(void *ptr, size_t nbytes) if (avail == nunits) { oh->h.size = nunits; prev->h.next = next->h.next; + _freep = prev; return ptr; }