devilhorns pushed a commit to branch master.

commit 0f925220e1054cdde9e6c04a3330c4d9ff9e7ea8
Author: Chris Michael <[email protected]>
Date:   Mon Aug 5 13:48:23 2013 +0100

    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 <[email protected]>
---
 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 7a0d5e1..b4564e5 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() */

-- 

------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk

Reply via email to