aboutsummaryrefslogtreecommitdiff
path: root/ares/ares__get_hostent.c
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2009-10-08 18:38:29 +0000
committerYang Tse <yangsita@gmail.com>2009-10-08 18:38:29 +0000
commita5ba25a5f6062a6d6b3ae9df9cb80c635ef80436 (patch)
tree88785e93b214d853d39d98d119c90b646eebe4da /ares/ares__get_hostent.c
parentb4e6418aef5cd4f3e7724ae71c6760ff04e78c30 (diff)
Fix compiler warning
Diffstat (limited to 'ares/ares__get_hostent.c')
-rw-r--r--ares/ares__get_hostent.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/ares/ares__get_hostent.c b/ares/ares__get_hostent.c
index 4371c5bf7..0d4aee215 100644
--- a/ares/ares__get_hostent.c
+++ b/ares/ares__get_hostent.c
@@ -38,10 +38,10 @@ int ares__get_hostent(FILE *fp, int family, struct hostent **host)
{
char *line = NULL, *p, *q, **alias;
char *txtaddr, *txthost, *txtalias;
- int status, linesize, addrfam, naliases;
+ int status, addrfam;
+ size_t addrlen, linesize, naliases;
struct in_addr addr;
struct in6_addr addr6;
- size_t addrlen;
struct hostent *hostent = NULL;
*host = NULL; /* Assume failure */
@@ -194,12 +194,13 @@ int ares__get_hostent(FILE *fp, int family, struct hostent **host)
memcpy(hostent->h_addr_list[0], &addr6, sizeof(struct in6_addr));
/* Copy aliases. */
- hostent->h_aliases = malloc((((size_t)naliases) + 1) * sizeof(char *));
+ hostent->h_aliases = malloc((naliases + 1) * sizeof(char *));
if (!hostent->h_aliases)
break;
alias = hostent->h_aliases;
- while (naliases >= 0)
+ while (naliases)
*(alias + naliases--) = NULL;
+ *alias = NULL;
while (txtalias)
{
p = txtalias;