diff --git a/ares_parse_aaaa_reply.c b/ares_parse_aaaa_reply.c index a34a3071..31e4a8c3 100644 --- a/ares_parse_aaaa_reply.c +++ b/ares_parse_aaaa_reply.c @@ -242,6 +242,8 @@ int ares_parse_aaaa_reply(const unsigned char *abuf, int alen, for (i = 0; i < naddrs; i++) hostent->h_addr_list[i] = (char *) &addrs[i]; hostent->h_addr_list[naddrs] = NULL; + if (!naddrs && addrs) + free(addrs); *host = hostent; return ARES_SUCCESS; }