diff options
author | Daniel Stenberg <daniel@haxx.se> | 2004-05-27 07:09:21 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2004-05-27 07:09:21 +0000 |
commit | 5690a2b493d2df6de999c451dd2dafb6b89f71e7 (patch) | |
tree | b19235a92fd4249151d2b6d3c871b358d09b07ce /ares | |
parent | ff0429a802365250d4e47df718f431284c023aa8 (diff) |
better checks to avoid free(NULL)
Diffstat (limited to 'ares')
-rw-r--r-- | ares/ares__get_hostent.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ares/ares__get_hostent.c b/ares/ares__get_hostent.c index f05d71299..bf99627e2 100644 --- a/ares/ares__get_hostent.c +++ b/ares/ares__get_hostent.c @@ -140,11 +140,11 @@ int ares__get_hostent(FILE *fp, struct hostent **host) memcpy(hostent->h_addr_list[0], &addr, sizeof(struct in_addr)); hostent->h_addr_list[1] = NULL; *host = hostent; - if(line) - free(line); + free(line); return ARES_SUCCESS; } - free(line); + if(line) + free(line); if (status == ARES_SUCCESS) { @@ -160,7 +160,7 @@ int ares__get_hostent(FILE *fp, struct hostent **host) } if(hostent->h_aliases) free(hostent->h_aliases); - if (hostent->h_addr_list) + if (hostent->h_addr_list && hostent->h_addr_list[0]) free(hostent->h_addr_list[0]); if(hostent->h_addr_list) free(hostent->h_addr_list); |