about summary refs log tree commit diff
path: root/malloc/malloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'malloc/malloc.c')
-rw-r--r--malloc/malloc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 5a5ea8fc71..c3040f4627 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2036,7 +2036,8 @@ new_heap(size) size_t size;
   if(p1 != MAP_FAILED) {
     p2 = (char *)(((unsigned long)p1 + (HEAP_MAX_SIZE-1)) & ~(HEAP_MAX_SIZE-1));
     ul = p2 - p1;
-    munmap(p1, ul);
+    if (ul)
+      munmap(p1, ul);
     munmap(p2 + HEAP_MAX_SIZE, HEAP_MAX_SIZE - ul);
   } else {
     /* Try to take the chance that an allocation of only HEAP_MAX_SIZE