summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnas Nashif <anas.nashif@intel.com>2012-10-30 13:57:28 -0700
committerAnas Nashif <anas.nashif@intel.com>2012-10-30 13:57:28 -0700
commite8040274aea98e1671fb824fdc75028d10084456 (patch)
tree8098eddf4e46642a234f778fcad62471e42715fa
parent600dd9d58368c6155cb40a8500cafd7e545bb0fb (diff)
downloadc-ares-e8040274aea98e1671fb824fdc75028d10084456.tar.gz
c-ares-e8040274aea98e1671fb824fdc75028d10084456.tar.bz2
c-ares-e8040274aea98e1671fb824fdc75028d10084456.zip
fix segfault triggered in ares init option
-rw-r--r--ares_init.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/ares_init.c b/ares_init.c
index 44d4cf9..e163289 100644
--- a/ares_init.c
+++ b/ares_init.c
@@ -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)