summary refs log tree commit diff
path: root/Src/mem.c
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2016-10-19 07:31:46 -0700
committerBarton E. Schaefer <schaefer@zsh.org>2016-10-19 07:31:46 -0700
commitb2d280038f97111144ce8aeb8ec293510b6b8e21 (patch)
tree155351bdc4c5a151f487cc26511aba63c5371407 /Src/mem.c
parent7e7e2d7e63b52a6a2e990090954328bbf7fa5d80 (diff)
downloadzsh-b2d280038f97111144ce8aeb8ec293510b6b8e21.tar.gz
zsh-b2d280038f97111144ce8aeb8ec293510b6b8e21.tar.xz
zsh-b2d280038f97111144ce8aeb8ec293510b6b8e21.zip
39680: correctly handle case of popping last arena
This mattered only when compiling with --enable-stack-allocation because
otherwise the heap was never completely empty.
Diffstat (limited to 'Src/mem.c')
-rw-r--r--Src/mem.c3
1 files changed, 2 insertions, 1 deletions
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