summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--Src/mem.c3
2 files changed, 6 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index d666a73bb..6e339b5ea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2016-10-19  Barton E. Schaefer  <schaefer@zsh.org>
+
+	* 39680: Src/mem.c: correctly handle case of popping last arena
+
 2016-10-19  Peter Stephenson  <p.stephenson@samsung.com>
 
 	* 39678: Src/builtin.c, Test/D07multibyte.ztst: printf %q
diff --git a/Src/mem.c b/Src/mem.c
index a1744c6d9..8c7eb8017 100644
--- a/Src/mem.c
+++ b/Src/mem.c
@@ -497,7 +497,8 @@ popheap(void)
 		    continue;
 		}
 		h->next = NULL;
-	    }
+	    } else if (hl == h)	/* This is the last arena of all */
+		hl = NULL;
 #ifdef USE_MMAP
 	    munmap((void *) h, h->size);
 #else