about summary refs log tree commit diff
path: root/Src/subst.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2000-06-01 09:10:15 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2000-06-01 09:10:15 +0000
commit4608712264c8549a9217dfa209ed6bdfeb941355 (patch)
tree3db98816cfeabe854710e76535ecbf453a020040 /Src/subst.c
parent3f8f27929472cdd5ed78543e123b72aebe61b847 (diff)
downloadzsh-4608712264c8549a9217dfa209ed6bdfeb941355.tar.gz
zsh-4608712264c8549a9217dfa209ed6bdfeb941355.tar.xz
zsh-4608712264c8549a9217dfa209ed6bdfeb941355.zip
FR & pws: promptexpand memory leaks; NEWS notes
Diffstat (limited to 'Src/subst.c')
-rw-r--r--Src/subst.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/Src/subst.c b/Src/subst.c
index c404f794d..a6d98a8c1 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -1661,18 +1661,24 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
 		aval = arrdup(aval), copied = 1;
 	    ap = aval;
 	    for (; *ap; ap++) {
+		char *tmps;
 		unmetafy(*ap, &len);
 		untokenize(*ap);
-		*ap = unmetafy(promptexpand(metafy(*ap, len, META_NOALLOC),
-					    0, NULL, NULL), &len);
+		tmps = unmetafy(promptexpand(metafy(*ap, len, META_NOALLOC),
+					     0, NULL, NULL), &len);
+		*ap = dupstring(tmps);
+		free(tmps);
 	    }
 	} else {
+	    char *tmps;
 	    if (!copied)
 		val = dupstring(val), copied = 1;
 	    unmetafy(val, &len);
 	    untokenize(val);
-	    val = unmetafy(promptexpand(metafy(val, len, META_NOALLOC),
+	    tmps = unmetafy(promptexpand(metafy(val, len, META_NOALLOC),
 					0, NULL, NULL), &len);
+	    val = dupstring(tmps);
+	    free(tmps);
 	}
 	opts[PROMPTSUBST] = ops;
 	opts[PROMPTBANG] = opb;