From 23f98c3e1d4792e32c616e1f73c383988bd86a9c Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Sat, 18 Jan 2014 21:22:11 -0800 Subject: 32285: restart the fheap search in freeheap if the current fheap arena is about to be discarded; fixes crash --- Src/mem.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Src') 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 -- cgit 1.4.1