summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--Src/hist.c4
2 files changed, 5 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index c7749ba10..62885ed36 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2008-09-10  Clint Adams  <clint@zsh.org>
 
+	* 25639: Src/hist.c: free ptr2 if hsubl is NULL.
+
 	* 25638: Src/Zle/compmatch.c: remove unnecessary ternary expression
 	in match_str.
 
diff --git a/Src/hist.c b/Src/hist.c
index 521baf613..f3979dfc0 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -346,8 +346,10 @@ getsubsargs(char *subline, int *gbalp, int *cflagp)
     if (strlen(ptr1)) {
 	zsfree(hsubl);
 	hsubl = ptr1;
-    } else if (!hsubl)		/* fail silently on this */
+    } else if (!hsubl) {		/* fail silently on this */
+	zsfree(ptr2);
 	return 0;
+    }
     zsfree(hsubr);
     hsubr = ptr2;
     follow = ingetc();