summaryrefslogtreecommitdiff
path: root/libc/stdlib/malloc
diff options
context:
space:
mode:
authorMiles Bader <miles@lsi.nec.co.jp>2002-09-09 07:40:07 +0000
committerMiles Bader <miles@lsi.nec.co.jp>2002-09-09 07:40:07 +0000
commit5752e107955723304ecb5e4ec02cedf7f350d80c (patch)
tree20f268a3699a3f9cc1c7865c161d764fd5e334e2 /libc/stdlib/malloc
parent8b02a71f53d75bd679c46141a0a2a8f8b26aef19 (diff)
(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.
Diffstat (limited to 'libc/stdlib/malloc')
-rw-r--r--libc/stdlib/malloc/realloc.c2
1 files changed, 1 insertions, 1 deletions
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. */