diff options
author | Yu Jiung <jiung.yu@samsung.com> | 2016-11-09 11:18:45 +0900 |
---|---|---|
committer | Yu Jiung <jiung.yu@samsung.com> | 2016-11-09 11:18:55 +0900 |
commit | eb886f120599b2a184db20b527db6dfdfcb7852e (patch) | |
tree | b49d8075742c4a27b237fa183cb68670e421d398 /ares__read_line.c | |
parent | b6627e2c19506bd30328969ea8aab73fa0945f36 (diff) | |
download | c-ares-eb886f120599b2a184db20b527db6dfdfcb7852e.tar.gz c-ares-eb886f120599b2a184db20b527db6dfdfcb7852e.tar.bz2 c-ares-eb886f120599b2a184db20b527db6dfdfcb7852e.zip |
Imported Upstream version 1.11.0upstream/1.11.0
Change-Id: I238c24b75a10aa902d9bc4076ed68b76b5e2a750
Diffstat (limited to 'ares__read_line.c')
-rw-r--r-- | ares__read_line.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/ares__read_line.c b/ares__read_line.c index bd9504f..c62ad2a 100644 --- a/ares__read_line.c +++ b/ares__read_line.c @@ -36,7 +36,7 @@ int ares__read_line(FILE *fp, char **buf, size_t *bufsize) if (*buf == NULL) { - *buf = malloc(128); + *buf = ares_malloc(128); if (!*buf) return ARES_ENOMEM; *bufsize = 128; @@ -59,9 +59,13 @@ int ares__read_line(FILE *fp, char **buf, size_t *bufsize) continue; /* Allocate more space. */ - newbuf = realloc(*buf, *bufsize * 2); + newbuf = ares_realloc(*buf, *bufsize * 2); if (!newbuf) - return ARES_ENOMEM; + { + ares_free(*buf); + *buf = NULL; + return ARES_ENOMEM; + } *buf = newbuf; *bufsize *= 2; } |