1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-23 16:40:24 +02:00

Fix up memory allocation for previous patch

This commit is contained in:
Peter Stephenson 2015-02-17 09:56:09 +00:00
parent 126fb61c7c
commit 9b21dcada9
2 changed files with 12 additions and 5 deletions

View file

@ -1,6 +1,12 @@
2015-02-17 Peter Stephenson <p.stephenson@samsung.com>
* 34563: Src/input.c: Fix up memory allocation in 34560.
2015-02-16 Peter Stephenson <p.stephenson@samsung.com>
* 34560: Src/input. Src/lex.c, Src/zsh.h, Test/C01arith.ztst:
case of $(( that turned into a $(...) and a (...) with
multiple lines read before it found out.
* 34558: Doc/Zsh/func.yo: preexec doc erroneously claimed $1
was empty if line removed from history.

View file

@ -348,12 +348,13 @@ inputline(void)
int oldlen = (int)(inbufptr - inbuf) + inbufleft;
if (inbufflags & INP_FREE) {
inbuf = realloc(inbuf, oldlen + newlen + 1);
inbufptr += inbuf - oinbuf;
strcpy(inbuf + oldlen, ingetcline);
} else {
/* Paranoia: don't think this is used */
DPUTS(1, "Appending to unallocated input line.");
inbuf = zalloc(oldlen + newlen + 1);
memcpy(inbuf, oinbuf, oldlen);
}
inbufptr += inbuf - oinbuf;
strcpy(inbuf + oldlen, ingetcline);
free(ingetcline);
inbufleft += newlen;
inbufct += newlen;
inbufflags |= INP_FREE;