ares_init potential memory leak

If initializing using default settings fails, there may be a memory leak of
search domains that were set by system configuration.

Fixes Issue: #724
Fix By: Brad House (@bradh352)
v1.27
Brad House 11 months ago
parent ee47b93218
commit d9a84fc797
  1. 25
      src/lib/ares_init.c

@ -261,31 +261,6 @@ static ares_status_t init_by_defaults(ares_channel_t *channel)
}
error:
if (rc) {
if (channel->domains && channel->domains[0]) {
ares_free(channel->domains[0]);
}
if (channel->domains) {
ares_free(channel->domains);
channel->domains = NULL;
}
if (channel->lookups) {
ares_free(channel->lookups);
channel->lookups = NULL;
}
if (channel->resolvconf_path) {
ares_free(channel->resolvconf_path);
channel->resolvconf_path = NULL;
}
if (channel->hosts_path) {
ares_free(channel->hosts_path);
channel->hosts_path = NULL;
}
}
if (hostname) {
ares_free(hostname);
}

Loading…
Cancel
Save