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

failure of init_by_defaults() and incomplete cleanup there.
pull/7/head
Yang Tse 14 years ago
parent 66e91438c5
commit 3d84eb3bbc
  1. 13
      ares_init.c

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

Loading…
Cancel
Save