about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Src/Zle/zle_params.c6
2 files changed, 9 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 2a467178f..80c7356f0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2003-03-05  Peter Stephenson  <pws@csr.com>
+
+	* 18318: Src/Zle/zle_params.c: memory leak in PREDISPLAY and
+	POSTDISPLAY when setting zero length values.
+
 2003-02-27  Peter Stephenson  <pws@csr.com>
 
 	* 18313: Src/Zle/zle_misc.c: After a single yank (hence
diff --git a/Src/Zle/zle_params.c b/Src/Zle/zle_params.c
index e5277d64d..f14785f01 100644
--- a/Src/Zle/zle_params.c
+++ b/Src/Zle/zle_params.c
@@ -482,8 +482,10 @@ set_prepost(unsigned char **textvar, int *lenvar, char *x)
     }
     if (x) {
 	unmetafy(x, lenvar);
-	*textvar = (unsigned char *)zalloc(*lenvar);
-	memcpy((char *)*textvar, x, *lenvar);
+	if (*lenvar) {
+	    *textvar = (unsigned char *)zalloc(*lenvar);
+	    memcpy((char *)*textvar, x, *lenvar);
+	}
 	free(x);
     }
 }