]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
r12317@catbus: nickm | 2007-04-09 15:50:51 -0400
authorNick Mathewson <nickm@torproject.org>
Mon, 9 Apr 2007 20:09:26 +0000 (20:09 +0000)
committerNick Mathewson <nickm@torproject.org>
Mon, 9 Apr 2007 20:09:26 +0000 (20:09 +0000)
 Fix second part of bug 411 (which was actually a separate bug): it isnt safe to clear a cell queue while the circuit is active.

svn:r9928

src/or/circuitlist.c

index d9da7a9728265e14f0df94b6ec83c43a25668ec3..a0aa27c7d1cbd583075a5fb69cedc11c935e882f 100644 (file)
@@ -398,19 +398,23 @@ circuit_free(circuit_t *circ)
       other->rend_splice = NULL;
     }
 
-    cell_queue_clear(&ocirc->p_conn_cells);
-
     tor_free(circ->onionskin);
 
     /* remove from map. */
     circuit_set_p_circid_orconn(ocirc, 0, NULL);
-  }
 
-  cell_queue_clear(&circ->n_conn_cells);
+    /* Clear cell queue _after_ removing it from the map.  Otherwise our
+     * "active" checks will be violated. */
+    cell_queue_clear(&ocirc->p_conn_cells);
+  }
 
   /* Remove from map. */
   circuit_set_n_circid_orconn(circ, 0, NULL);
 
+  /* Clear cell queue _after_ removing it from the map.  Otherwise our
+   * "active" checks will be violated. */
+  cell_queue_clear(&circ->n_conn_cells);
+
   memset(circ, 0xAA, sizeof(circuit_t)); /* poison memory */
   tor_free(mem);
 }