other->rend_splice = NULL;
}
- cell_queue_clear(ô->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(ô->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);
}