about summary refs log tree commit diff
path: root/Src/Zle
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2005-03-11 10:33:39 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2005-03-11 10:33:39 +0000
commit15b78be794713c7bb2c5c6c93b9011ca41b82d1d (patch)
tree2a6a20186d81e894d07cdfd4a48bcde8e62c9ff7 /Src/Zle
parent6ab396f5fb902cede91ba23e2108f79efb0c7a3b (diff)
downloadzsh-15b78be794713c7bb2c5c6c93b9011ca41b82d1d.tar.gz
zsh-15b78be794713c7bb2c5c6c93b9011ca41b82d1d.tar.xz
zsh-15b78be794713c7bb2c5c6c93b9011ca41b82d1d.zip
20966: fix crash in execute-named-command
Diffstat (limited to 'Src/Zle')
-rw-r--r--Src/Zle/zle_misc.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/Src/Zle/zle_misc.c b/Src/Zle/zle_misc.c
index b2c101b3a..022d98e64 100644
--- a/Src/Zle/zle_misc.c
+++ b/Src/Zle/zle_misc.c
@@ -911,8 +911,9 @@ executenamedcommand(char *prmt)
 		    showinglist = 0;
 		    zmult = zmultsav;
 		} else if (!nextnode(firstnode(namedcmdll))) {
-		    ZLE_STRING_T ztmp = stringaszleline(peekfirst(namedcmdll),
-							&len, NULL);
+		    char *peekstr = ztrdup(peekfirst(namedcmdll));
+		    ZLE_STRING_T ztmp = stringaszleline(peekstr, &len, NULL);
+		    zsfree(peekstr);
 		    ZS_memcpy(ptr = cmdbuf, ztmp, len);
 		    ptr += len;
 		    free(ztmp);
@@ -920,8 +921,9 @@ executenamedcommand(char *prmt)
 			goto unambiguous;
 		} else {
 		    int ltmp;
-		    ZLE_STRING_T ztmp = stringaszleline(peekfirst(namedcmdll),
-							&ltmp, NULL);
+		    char *peekstr = ztrdup(peekfirst(namedcmdll));
+		    ZLE_STRING_T ztmp = stringaszleline(peekstr, &ltmp, NULL);
+		    zsfree(peekstr);
 		    ZS_memcpy(cmdbuf, ztmp, ltmp);
 		    free(ztmp);
 		    ptr = cmdbuf + namedcmdambig;