From 5752e107955723304ecb5e4ec02cedf7f350d80c Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Mon, 9 Sep 2002 07:40:07 +0000 Subject: (realloc): Record the correct size in the malloc header in the case where we extended the existing allocation, and got back more than we asked for from the heap. --- libc/stdlib/malloc/realloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libc/stdlib/malloc') diff --git a/libc/stdlib/malloc/realloc.c b/libc/stdlib/malloc/realloc.c index db26866de..e4c8ad710 100644 --- a/libc/stdlib/malloc/realloc.c +++ b/libc/stdlib/malloc/realloc.c @@ -57,7 +57,7 @@ realloc (void *mem, size_t new_size) if (extra) /* Record the changed size. */ - MALLOC_SET_SIZE (base_mem, new_size); + MALLOC_SET_SIZE (base_mem, size + extra); else /* Our attempts to extend MEM in place failed, just allocate-and-copy. */ -- cgit v1.2.3