summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2015-02-23 17:38:16 +0000
committerPeter Stephenson <pws@zsh.org>2015-02-23 17:38:16 +0000
commitc96606cc0617b85d3bf0784d0bf1ecd71e44cbd7 (patch)
tree8109f10487b615436c35e66a062b1f03df22a4e3
parented43cf27682ee98cb8cf867e9d8e52ca72a52591 (diff)
downloadzsh-c96606cc0617b85d3bf0784d0bf1ecd71e44cbd7.tar.gz
zsh-c96606cc0617b85d3bf0784d0bf1ecd71e44cbd7.tar.xz
zsh-c96606cc0617b85d3bf0784d0bf1ecd71e44cbd7.zip
34623: free history more often if "remetafying"
-rw-r--r--ChangeLog4
-rw-r--r--Src/hist.c8
2 files changed, 10 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 9e98f5550..1d5b9ce04 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2015-02-23  Peter Stephenson  <p.stephenson@samsung.com>
+
+	* 34623: Src/hist.c: free history more often in previous case.
+
 2015-02-23  Mikael Magnusson  <mikachu@gmail.com>
 
 	* 34615 + 34619: Src/hist.c: Remeta one frame earlier
diff --git a/Src/hist.c b/Src/hist.c
index c530e7283..aa07ce875 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -2593,8 +2593,6 @@ readhistfile(char *fn, int err, int readflags)
 	    start = pt;
 	    uselex = isset(HISTLEXWORDS) && !(readflags & HFILE_FAST);
 	    histsplitwords(pt, &words, &nwords, &nwordpos, uselex);
-	    if (uselex)
-		freeheap();
 
 	    he->nwords = nwordpos/2;
 	    if (he->nwords) {
@@ -2607,6 +2605,12 @@ readhistfile(char *fn, int err, int readflags)
 		freehistnode(&he->node);
 		curhist--;
 	    }
+	    /*
+	     * Do this last out of paranoia in case use of
+	     * heap is disguised...
+	     */
+	    if (uselex || remeta)
+		freeheap();
 	}
 	if (start && readflags & HFILE_USE_OPTIONS) {
 	    zsfree(lasthist.text);