mirror of
https://frontier.innolan.net/rainlance/c-ares.git
synced 2025-10-06 07:59:43 +00:00
ares_gethostbyname: don't leak valid-but-empty hostent
If an AF_UNSPEC query gets a valid response to its AAAA query, but which has no IPv6 addresses in it, then the code chains on to a A record query. However, the hostent from the AAAA response was being leaked along the way (because it gets replaced before the follow-on end_hquery() invocation).
This commit is contained in:
@ -194,6 +194,8 @@ static void host_callback(void *arg, int status, int timeouts,
|
||||
/* The query returned something but either there were no AAAA
|
||||
records (e.g. just CNAME) or the response was malformed. Try
|
||||
looking up A instead. */
|
||||
if (host)
|
||||
ares_free_hostent(host);
|
||||
hquery->sent_family = AF_INET;
|
||||
ares_search(hquery->channel, hquery->name, C_IN, T_A,
|
||||
host_callback, hquery);
|
||||
|
Reference in New Issue
Block a user