diff options
author | Yu Jiung <jiung.yu@samsung.com> | 2016-11-10 16:24:08 +0900 |
---|---|---|
committer | Yu Jiung <jiung.yu@samsung.com> | 2016-11-10 16:25:02 +0900 |
commit | 8166b0204b6945a4fdb89bbae0b0b7168a7cf6e8 (patch) | |
tree | 81f0750d91aa467df3ee81cf30d22a65db2e6685 /ares__get_hostent.c | |
parent | ccccebb78520ec3a26a18370936516b12ae5d53a (diff) | |
parent | 45e88a8337839e5fd88519bc55467053d521c9f6 (diff) | |
download | c-ares-8166b0204b6945a4fdb89bbae0b0b7168a7cf6e8.tar.gz c-ares-8166b0204b6945a4fdb89bbae0b0b7168a7cf6e8.tar.bz2 c-ares-8166b0204b6945a4fdb89bbae0b0b7168a7cf6e8.zip |
Merge branch 'tizen' into tizen_basetizen_4.0.m2_releasetizen_4.0.IoT.p1_releasesubmit/tizen_base/20170705.023439submit/tizen_base/20170703.013654submit/tizen_4.0_base/20170828.000001submit/tizen_4.0_base/20170828.000000submit/tizen_4.0_base/20170811.071500accepted/tizen/base/20170707.183634accepted/tizen/4.0/base/20170828.221324accepted/tizen/4.0/base/20170811.093019
Conflicts:
packaging/c-ares.spec
Change-Id: I1ec10e394aed3ef19ee21fefbe3aba7d7a615c74
Diffstat (limited to 'ares__get_hostent.c')
-rw-r--r-- | ares__get_hostent.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/ares__get_hostent.c b/ares__get_hostent.c index 4497d60..d2f9503 100644 --- a/ares__get_hostent.c +++ b/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; } |