File 0003-ares_init.c-fix-segfault-triggered-in-ares_init_opti.patch of Package libcares2
From 8f917639055e4e190c6045afffa65cb56caa5463 Mon Sep 17 00:00:00 2001
From: Yang Tse <yangsita@gmail.com>
Date: Wed, 7 Sep 2011 00:30:53 +0200
Subject: [PATCH 3/3] ares_init.c: fix segfault triggered in ares_init_options() upon previous
failure of init_by_defaults() and incomplete cleanup there.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Cristian RodrÃguez <crrodriguez@opensuse.org>
---
ares_init.c | 13 ++++++++++---
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)
--
1.7.4.1