about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--Etc/NEWS6
-rw-r--r--Src/subst.c12
-rw-r--r--Src/utils.c1
4 files changed, 25 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 8f91937f2..2265d7c93 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2000-06-01  Peter Stephenson  <pws@cambridgesiliconradio.com>
+
+	* unposted: Etc/NEWS: notes for 3.1.8.
+
+	* 11707: Src/subst.c: further promptexpand leaks.
+
+	* Felix Rosencrantz: 11700: Src/utils.c memory leak in return
+	value of promptexpand.
+
 2000-05-31  Peter Stephenson  <pws@pwstephenson.fsnet.co.uk>
 
 	* 11696: Src/params.c: fix bugs reported in 10990 localising
diff --git a/Etc/NEWS b/Etc/NEWS
index 7f954814c..a4ae987a7 100644
--- a/Etc/NEWS
+++ b/Etc/NEWS
@@ -2,6 +2,12 @@
 CHANGES FROM PREVIOUS VERSIONS OF ZSH
 -------------------------------------
 				     
+New features in zsh version 3.1.8
+---------------------------------
+This is primarily a bug-fix version.  There are only a few user-visible
+changes.
+ - Array slices ${array[a,b]} with b < a now correctly have zero length.
+
 New features in zsh version 3.1.7
 ---------------------------------
 Further enhancements to new completion system:
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;
diff --git a/Src/utils.c b/Src/utils.c
index 116c8089e..b4be1c4f1 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -807,6 +807,7 @@ printprompt4(void)
 	opts[XTRACE] = t;
 
 	fprintf(xtrerr, "%s", s);
+	free(s);
     }
 }