1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-23 04:30: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

@ -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;