aboutsummaryrefslogtreecommitdiff
path: root/deps/cares/src/ares__get_hostent.c
diff options
context:
space:
mode:
authorFedor Indutny <fedor@indutny.com>2016-02-04 16:34:47 -0500
committerFedor Indutny <fedor@indutny.com>2016-02-08 14:44:19 -0500
commit1258b0166dc6e68c2592be3410e54d5cb19bc04b (patch)
tree5f21d4a0c2789b78c231e6b2c9fbd6ac29ddac4c /deps/cares/src/ares__get_hostent.c
parent106c6cfe98db21cc62d339056710491550f69565 (diff)
downloadandroid-node-v8-1258b0166dc6e68c2592be3410e54d5cb19bc04b.tar.gz
android-node-v8-1258b0166dc6e68c2592be3410e54d5cb19bc04b.tar.bz2
android-node-v8-1258b0166dc6e68c2592be3410e54d5cb19bc04b.zip
deps: sync with upstream bagder/c-ares@2bae2d5
PR-URL: https://github.com/nodejs/node/pull/5090 Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Diffstat (limited to 'deps/cares/src/ares__get_hostent.c')
-rw-r--r--deps/cares/src/ares__get_hostent.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/deps/cares/src/ares__get_hostent.c b/deps/cares/src/ares__get_hostent.c
index 4497d60d0d..d2f9503493 100644
--- a/deps/cares/src/ares__get_hostent.c
+++ b/deps/cares/src/ares__get_hostent.c
@@ -94,7 +94,7 @@ int ares__get_hostent(FILE *fp, int family, struct hostent **host)
p++;
if (!*p)
/* Ignore line if reached end of line. */
- continue;
+ continue; /* LCOV_EXCL_LINE: trailing whitespace already stripped */
/* Pointer to start of host name. */
txthost = p;
@@ -164,7 +164,7 @@ int ares__get_hostent(FILE *fp, int family, struct hostent **host)
*/
/* Allocate memory for the hostent structure. */
- hostent = malloc(sizeof(struct hostent));
+ hostent = ares_malloc(sizeof(struct hostent));
if (!hostent)
break;
@@ -173,16 +173,16 @@ int ares__get_hostent(FILE *fp, int family, struct hostent **host)
hostent->h_addr_list = NULL;
/* Copy official host name. */
- hostent->h_name = strdup(txthost);
+ hostent->h_name = ares_strdup(txthost);
if (!hostent->h_name)
break;
/* Copy network address. */
- hostent->h_addr_list = malloc(2 * sizeof(char *));
+ hostent->h_addr_list = ares_malloc(2 * sizeof(char *));
if (!hostent->h_addr_list)
break;
hostent->h_addr_list[1] = NULL;
- hostent->h_addr_list[0] = malloc(addrlen);
+ hostent->h_addr_list[0] = ares_malloc(addrlen);
if (!hostent->h_addr_list[0])
break;
if (addr.family == AF_INET)
@@ -191,7 +191,7 @@ int ares__get_hostent(FILE *fp, int family, struct hostent **host)
memcpy(hostent->h_addr_list[0], &addr.addrV6, sizeof(addr.addrV6));
/* Copy aliases. */
- hostent->h_aliases = malloc((naliases + 1) * sizeof(char *));
+ hostent->h_aliases = ares_malloc((naliases + 1) * sizeof(char *));
if (!hostent->h_aliases)
break;
alias = hostent->h_aliases;
@@ -207,7 +207,7 @@ int ares__get_hostent(FILE *fp, int family, struct hostent **host)
while (*q && ISSPACE(*q))
q++;
*p = '\0';
- if ((*alias = strdup(txtalias)) == NULL)
+ if ((*alias = ares_strdup(txtalias)) == NULL)
break;
alias++;
txtalias = *q ? q : NULL;
@@ -221,7 +221,7 @@ int ares__get_hostent(FILE *fp, int family, struct hostent **host)
hostent->h_length = aresx_uztoss(addrlen);
/* Free line buffer. */
- free(line);
+ ares_free(line);
/* Return hostent successfully */
*host = hostent;
@@ -231,7 +231,7 @@ int ares__get_hostent(FILE *fp, int family, struct hostent **host)
/* If allocated, free line buffer. */
if (line)
- free(line);
+ ares_free(line);
if (status == ARES_SUCCESS)
{
@@ -239,20 +239,20 @@ int ares__get_hostent(FILE *fp, int family, struct hostent **host)
if (hostent)
{
if (hostent->h_name)
- free((char *) hostent->h_name);
+ ares_free((char *) hostent->h_name);
if (hostent->h_aliases)
{
for (alias = hostent->h_aliases; *alias; alias++)
- free(*alias);
- free(hostent->h_aliases);
+ ares_free(*alias);
+ ares_free(hostent->h_aliases);
}
if (hostent->h_addr_list)
{
if (hostent->h_addr_list[0])
- free(hostent->h_addr_list[0]);
- free(hostent->h_addr_list);
+ ares_free(hostent->h_addr_list[0]);
+ ares_free(hostent->h_addr_list);
}
- free(hostent);
+ ares_free(hostent);
}
return ARES_ENOMEM;
}