[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] Avoid double-free on tor-resolve failure (backport)



Update of /home/or/cvsroot/tor/src/or
In directory moria.mit.edu:/tmp/cvs-serv6439/src/or

Modified Files:
      Tag: tor-0_0_9-patches
	connection_edge.c 
Log Message:
Avoid double-free on tor-resolve failure (backport)

Index: connection_edge.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/connection_edge.c,v
retrieving revision 1.264.2.7
retrieving revision 1.264.2.8
diff -u -d -r1.264.2.7 -r1.264.2.8
--- connection_edge.c	5 Feb 2005 21:24:39 -0000	1.264.2.7
+++ connection_edge.c	5 Feb 2005 23:55:29 -0000	1.264.2.8
@@ -880,8 +880,10 @@
 
   /* send it off to the gethostbyname farm */
   switch (dns_resolve(dummy_conn)) {
+    case -1: /* Impossible to resolve; a resolved cell was sent. */
+      /* The connection got freed; leave it alone. */
+      return 0;
     case 1: /* The result was cached; a resolved cell was sent. */
-    case -1:
       connection_free(dummy_conn);
       return 0;
     case 0: /* resolve added to pending list */