mirror of
https://github.com/rkd77/elinks.git
synced 2024-11-04 08:17:17 -05:00
l_pipe_read: Don't leak the old block if mem_realloc fails.
This commit is contained in:
parent
5e17321b30
commit
e2f26e45f8
@ -204,8 +204,10 @@ l_pipe_read(LS)
|
||||
size_t l = fread(buf, 1, sizeof(buf), fp);
|
||||
|
||||
if (l > 0) {
|
||||
s = mem_realloc(s, len + l);
|
||||
if (!s) goto lua_error;
|
||||
unsigned char *news = mem_realloc(s, len + l);
|
||||
|
||||
if (!news) goto lua_error;
|
||||
s = news;
|
||||
memcpy(s + len, buf, l);
|
||||
len += l;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user