about summary refs log tree commit diff
path: root/malloc/hooks.c
diff options
context:
space:
mode:
Diffstat (limited to 'malloc/hooks.c')
-rw-r--r--malloc/hooks.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/malloc/hooks.c b/malloc/hooks.c
index 537995aeab..9659ec5fbe 100644
--- a/malloc/hooks.c
+++ b/malloc/hooks.c
@@ -354,8 +354,11 @@ realloc_check(oldmem, bytes, caller)
     }
   } else {
 #endif /* HAVE_MMAP */
-    if (top_check() >= 0)
-      newmem = _int_realloc(&main_arena, oldp, bytes+1);
+    if (top_check() >= 0) {
+      INTERNAL_SIZE_T nb;
+      checked_request2size(bytes + 1, nb);
+      newmem = _int_realloc(&main_arena, oldp, nb);
+    }
 #if 0 /* Erase freed memory. */
     if(newmem)
       newp = mem2chunk(newmem);