about summary refs log tree commit diff
path: root/Src/Zle/zle_params.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2003-03-05 17:24:37 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2003-03-05 17:24:37 +0000
commit5660eb86ac16a0bb6d7f14d0026015f90bfa5c45 (patch)
tree14ebe64e53d4cc8e42d72fe1328a3c0a17336dd2 /Src/Zle/zle_params.c
parente0d2c9c0b344778492260552e2c8c9bde1526077 (diff)
downloadzsh-5660eb86ac16a0bb6d7f14d0026015f90bfa5c45.tar.gz
zsh-5660eb86ac16a0bb6d7f14d0026015f90bfa5c45.tar.xz
zsh-5660eb86ac16a0bb6d7f14d0026015f90bfa5c45.zip
183818: memory leak in zle_params.c
Diffstat (limited to 'Src/Zle/zle_params.c')
-rw-r--r--Src/Zle/zle_params.c6
1 files changed, 4 insertions, 2 deletions
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);
     }
 }