Skip to content

Commit

Permalink
ares_init potential memory leak
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
bradh352 committed Mar 12, 2024
1 parent ee47b93 commit d9a84fc
Showing 1 changed file with 0 additions and 25 deletions.
25 changes: 0 additions & 25 deletions src/lib/ares_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit d9a84fc

Please sign in to comment.