summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2007-11-19 16:53:09 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2007-11-19 16:53:09 +0000
commitbcfddb03c7b1c0491a7cdc9ef6da9e7d9eaa18df (patch)
tree248dde3240effd3102ed17bb3d562bb94fb4c1d8 /Src
parentf596decec4341aef09d8b3601c9a9c6c5fa55ec7 (diff)
downloadzsh-bcfddb03c7b1c0491a7cdc9ef6da9e7d9eaa18df.tar.gz
zsh-bcfddb03c7b1c0491a7cdc9ef6da9e7d9eaa18df.tar.xz
zsh-bcfddb03c7b1c0491a7cdc9ef6da9e7d9eaa18df.zip
users/12230: fix problem setting killring to zero size
Diffstat (limited to 'Src')
-rw-r--r--Src/Zle/zle_params.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/Src/Zle/zle_params.c b/Src/Zle/zle_params.c
index dffe57161..817d6e57a 100644
--- a/Src/Zle/zle_params.c
+++ b/Src/Zle/zle_params.c
@@ -497,16 +497,18 @@ set_killring(UNUSED(Param pm), char **x)
 	 */
 	int kpos = 0;
 	kringsize = arrlen(x);
-	kring = (Cutbuffer)zshcalloc(kringsize * sizeof(struct cutbuffer));
-	for (p = x; *p; p++) {
-	    int n, len = strlen(*p);
-	    kptr = kring + kpos;
-
-	    kptr->buf = stringaszleline(*p, 0, &n, NULL, NULL);
-	    kptr->len = n;
-
-	    zfree(*p, len+1);
-	    kpos = (kpos + kringsize -1 ) % kringsize;
+	if (kringsize != 0) {
+	    kring = (Cutbuffer)zshcalloc(kringsize * sizeof(struct cutbuffer));
+	    for (p = x; *p; p++) {
+		int n, len = strlen(*p);
+		kptr = kring + kpos;
+
+		kptr->buf = stringaszleline(*p, 0, &n, NULL, NULL);
+		kptr->len = n;
+
+		zfree(*p, len+1);
+		kpos = (kpos + kringsize -1 ) % kringsize;
+	    }
 	}
 	free(x);
     }