summaryrefslogtreecommitdiff
path: root/libc/stdlib/malloc/realloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/stdlib/malloc/realloc.c')
-rw-r--r--libc/stdlib/malloc/realloc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libc/stdlib/malloc/realloc.c b/libc/stdlib/malloc/realloc.c
index 7d8227aff..7a89712e3 100644
--- a/libc/stdlib/malloc/realloc.c
+++ b/libc/stdlib/malloc/realloc.c
@@ -39,7 +39,10 @@ realloc (void *mem, size_t new_size)
size_t ext_size = new_size - size;
void *ext_addr = (char *)base_mem + ext_size;
+ __malloc_lock ();
ext_size = __heap_alloc_at (&__malloc_heap, ext_addr, ext_size);
+ __malloc_unlock ();
+
if (! ext_size)
/* Our attempts to extend MEM in place failed, just
allocate-and-copy. */