summaryrefslogtreecommitdiff
path: root/Src
diff options
context:
space:
mode:
Diffstat (limited to 'Src')
-rw-r--r--Src/mem.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/Src/mem.c b/Src/mem.c
index 5275c6c98..d15721c28 100644
--- a/Src/mem.c
+++ b/Src/mem.c
@@ -367,6 +367,15 @@ freeheap(void)
}
#endif
} else {
+ if (h == fheap && h != heaps) {
+ /*
+ * When deallocating the last arena with free space,
+ * loop back through the list to find another one.
+ */
+ fheap = NULL;
+ hn = heaps;
+ continue;
+ }
#ifdef USE_MMAP
munmap((void *) h, h->size);
#else