about summary refs log tree commit diff
diff options
context:
space:
mode:
authorClint Adams <clint@users.sourceforge.net>2008-09-08 22:17:50 +0000
committerClint Adams <clint@users.sourceforge.net>2008-09-08 22:17:50 +0000
commitb4ee5adc251faffae472fb176214789327bf63b7 (patch)
tree39be0bc4e7afa9f68edcb51a3a269c866724e668
parentc715630baa75d5d65c68de3df852164342ff130c (diff)
downloadzsh-b4ee5adc251faffae472fb176214789327bf63b7.tar.gz
zsh-b4ee5adc251faffae472fb176214789327bf63b7.tar.xz
zsh-b4ee5adc251faffae472fb176214789327bf63b7.zip
25636: free s before returning with an error condition.
-rw-r--r--ChangeLog3
-rw-r--r--Src/Zle/zle_tricky.c8
2 files changed, 10 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 2b02d785b..6f351250e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2008-09-08  Clint Adams  <clint@zsh.org>
 
+	* 25636: Src/Zle/zle_tricky.c: free s before returning with an
+	error condition.
+
 	* 25634: Src/Zle/zle_main.c: free t before returning if both t and
 	errflag are set.
 
diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index 4786f30de..bc0152401 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -2834,8 +2834,14 @@ expandcmdpath(UNUSED(char **args))
     noaliases = 1;
     s = getcurcmd();
     noaliases = na;
-    if (!s || cmdwb < 0 || cmdwe < cmdwb)
+    if (!s)
+	return 1;
+
+    if (cmdwb < 0 || cmdwe < cmdwb) {
+	zsfree(s);
 	return 1;
+    }
+
     str = findcmd(s, 1);
     zsfree(s);
     if (!str)