commit 1acd5b871784b694808522b487b9dedea67068a2
parent d58f3f2eb9cb620b8746ff9f7b6c172a91720629
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:
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;
}