[or-cvs] Backport: another possible patch related to circuit_free an...

Nick Mathewson nickm at seul.org
Wed Dec 14 19:14:45 UTC 2005


Update of /home/or/cvsroot/tor/src/or
In directory moria:/tmp/cvs-serv32128/src/or

Modified Files:
      Tag: tor-0_1_0-patches
	circuitlist.c 
Log Message:
Backport: another possible patch related to circuit_free and memory stomping.

Index: circuitlist.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/circuitlist.c,v
retrieving revision 1.47.2.1
retrieving revision 1.47.2.2
diff -u -d -r1.47.2.1 -r1.47.2.2
--- circuitlist.c	5 Dec 2005 19:52:05 -0000	1.47.2.1
+++ circuitlist.c	14 Dec 2005 19:14:43 -0000	1.47.2.2
@@ -217,6 +217,7 @@
   tor_free(circ->build_state);
   circuit_free_cpath(circ->cpath);
   if (circ->rend_splice) {
+    tor_assert(circ->rend_splice->magic == CIRCUIT_MAGIC);
     circ->rend_splice->rend_splice = NULL;
   }
   /* Remove from map. */
@@ -611,9 +612,11 @@
   circ->marked_for_close = line;
   circ->marked_for_close_file = file;
 
-  if (circ->rend_splice && !circ->rend_splice->marked_for_close) {
-    /* do this after marking this circuit, to avoid infinite recursion. */
-    circuit_mark_for_close(circ->rend_splice);
+  if (circ->rend_splice) {
+    if (!circ->rend_splice->marked_for_close) {
+      /* do this after marking this circuit, to avoid infinite recursion. */
+      circuit_mark_for_close(circ->rend_splice);
+    }
     circ->rend_splice = NULL;
   }
 }



More information about the tor-commits mailing list