1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-27 04:40:59 +01: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> 2015-02-16 Peter Stephenson <p.stephenson@samsung.com>
* 34560: Src/input. Src/lex.c, Src/zsh.h, Test/C01arith.ztst: * 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 * 34558: Doc/Zsh/func.yo: preexec doc erroneously claimed $1
was empty if line removed from history. was empty if line removed from history.

View file

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