1
0
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:
Jakub Hrozek
2014-09-18 19:10:24 +02:00
parent 453578354f
commit bba4dc573f

View File

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