瀏覽代碼

Free placeholder circid/chan->circuit map entries on exit

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
Nick Mathewson 11 年之前
父節點
當前提交
852fd1819e
共有 2 個文件被更改,包括 15 次插入0 次删除
  1. 3 0
      changes/bug11278
  2. 12 0
      src/or/circuitlist.c

+ 3 - 0
changes/bug11278

@@ -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.

+ 12 - 0
src/or/circuitlist.c

@@ -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);
 }