1
0
mirror of https://frontier.innolan.net/rainlance/c-ares.git synced 2025-10-05 21:59:27 +00:00

ares_init.c: fix segfault triggered in ares_init_options() upon previous

failure of init_by_defaults() and incomplete cleanup there.
This commit is contained in:
Yang Tse
2011-09-07 00:30:53 +02:00
parent 66e91438c5
commit 3d84eb3bbc

View File

@ -1249,15 +1249,22 @@ static int init_by_defaults(ares_channel channel)
error:
if(rc) {
if(channel->servers)
if(channel->servers) {
free(channel->servers);
channel->servers = NULL;
}
if(channel->domains && channel->domains[0])
free(channel->domains[0]);
if(channel->domains)
if(channel->domains) {
free(channel->domains);
if(channel->lookups)
channel->domains = NULL;
}
if(channel->lookups) {
free(channel->lookups);
channel->lookups = NULL;
}
}
if(hostname)