mirror of
https://frontier.innolan.net/rainlance/c-ares.git
synced 2026-03-18 07:08:22 +00:00
ares__read_line: free buf on realloc failure
This commit is contained in:
@ -61,7 +61,10 @@ int ares__read_line(FILE *fp, char **buf, size_t *bufsize)
|
||||
/* Allocate more space. */
|
||||
newbuf = realloc(*buf, *bufsize * 2);
|
||||
if (!newbuf)
|
||||
return ARES_ENOMEM;
|
||||
{
|
||||
free(*buf);
|
||||
return ARES_ENOMEM;
|
||||
}
|
||||
*buf = newbuf;
|
||||
*bufsize *= 2;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user