diff options
Diffstat (limited to 'Src')
-rw-r--r-- | Src/Zle/zle_params.c | 22 |
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); } |