From 0f925220e1054cdde9e6c04a3330c4d9ff9e7ea8 Mon Sep 17 00:00:00 2001 From: Chris Michael Date: Mon, 5 Aug 2013 13:48:23 +0100 Subject: [PATCH] Fix potential double-free of so->answer. NB: dns_so_submit calls dns_so_reset twice (once at start, once at end on error). As so_reset will free so->answer the first time through, add validity check of so->answer for the second iteration. Signed-off-by: Chris Michael --- src/lib/ecore_con/dns.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/ecore_con/dns.c b/src/lib/ecore_con/dns.c index 7a0d5e1c9b..b4564e5323 100644 --- a/src/lib/ecore_con/dns.c +++ b/src/lib/ecore_con/dns.c @@ -5525,7 +5525,7 @@ void dns_so_close(struct dns_socket *so) { void dns_so_reset(struct dns_socket *so) { - free(so->answer); + if (so->answer) free(so->answer); memset(&so->state, '\0', sizeof *so - offsetof(struct dns_socket, state)); } /* dns_so_reset() */