diff options
author | Yang Tse <yangsita@gmail.com> | 2011-09-07 00:30:53 +0200 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2011-09-07 00:30:53 +0200 |
commit | 3d84eb3bbca244da90e17750a31520a1b1b24e88 (patch) | |
tree | dd5c1f43b046ef1e66a5e1abfc7c608bc7f99b64 /ares_init.c | |
parent | 66e91438c5bee15c765f5ea97c9006f747d06a7f (diff) | |
download | c-ares-3d84eb3bbca244da90e17750a31520a1b1b24e88.tar.gz c-ares-3d84eb3bbca244da90e17750a31520a1b1b24e88.tar.bz2 c-ares-3d84eb3bbca244da90e17750a31520a1b1b24e88.zip |
ares_init.c: fix segfault triggered in ares_init_options() upon previous
failure of init_by_defaults() and incomplete cleanup there.
Diffstat (limited to 'ares_init.c')
-rw-r--r-- | ares_init.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/ares_init.c b/ares_init.c index dd59fed..0c1d545 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) |