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.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 8eed746fff..f2246f6184 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2942,8 +2942,8 @@ chunk_alloc(ar_ptr, nb) arena *ar_ptr; INTERNAL_SIZE_T nb;
     {
 #if HAVE_MMAP
       /* A last attempt:  when we are out of address space in the arena,
-         try mmap anyway, disregarding n_mmaps_max.  */
-      if((victim = mmap_chunk(nb)) != 0)
+         try mmap anyway, as long as it is allowed at all.  */
+      if (n_mmaps_max > 0 && (victim = mmap_chunk(nb)) != 0)
         return victim;
 #endif
       return 0; /* propagate failure */