about summary refs log tree commit diff
path: root/Src/Zle/zle_params.c
diff options
context:
space:
mode:
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);
     }
 }