]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Free placeholder circid/chan->circuit map entries on exit
authorNick Mathewson <nickm@torproject.org>
Tue, 25 Mar 2014 14:14:26 +0000 (10:14 -0400)
committerNick Mathewson <nickm@torproject.org>
Tue, 25 Mar 2014 14:14:26 +0000 (10:14 -0400)
In circuitlist_free_all, we free all the circuits, removing them from
the map as we go, but we weren't actually freeing the placeholder
entries that we use to indicate pending DESTROY cells.

Fix for bug 11278; bugfix on the 7912 code that was merged in
0.2.5.1-alpha

changes/bug11278 [new file with mode: 0644]
src/or/circuitlist.c

diff --git a/changes/bug11278 b/changes/bug11278
new file mode 100644 (file)
index 0000000..4fa59fc
--- /dev/null
@@ -0,0 +1,3 @@
+  o Minor bugfixes:
+    - Free placeholder entries in our circuit table at exit; fixes
+      a harmless memory leak. Fixes bug 11278; bugfix on 0.2.5.1-alpha.
index b1efde5ad574650686c0ddab76c997d79fd3f2c7..5b8225a36ee9e295ac66a8fc3dfd2d73ce5b16d6 100644 (file)
@@ -833,6 +833,18 @@ circuit_free_all(void)
   smartlist_free(circuits_pending_chans);
   circuits_pending_chans = NULL;
 
+  {
+    chan_circid_circuit_map_t **elt, **next, *c;
+    for (elt = HT_START(chan_circid_map, &chan_circid_map);
+         elt;
+         elt = next) {
+      c = *elt;
+      next = HT_NEXT_RMV(chan_circid_map, &chan_circid_map, elt);
+
+      tor_assert(c->circuit == NULL);
+      tor_free(c);
+    }
+  }
   HT_CLEAR(chan_circid_map, &chan_circid_map);
 }