]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix a memleak in nodelist_assert_ok()
authorSebastian Hahn <sebastian@torproject.org>
Wed, 8 Jun 2011 19:38:42 +0000 (21:38 +0200)
committerSebastian Hahn <sebastian@torproject.org>
Wed, 8 Jun 2011 19:38:42 +0000 (21:38 +0200)
changes/coverity_master
src/or/nodelist.c

index ab174bcecc4a9b2f855ba596adaa8324757a152d..784dec3dc3b17a1c2d9d17d3432f9ae17119bb64 100644 (file)
@@ -1,6 +1,8 @@
   o Minor bugfixes:
     - Prevent using negative indices during unit test runs when read_all()
       fails. Spotted by coverity. Bugfix on 0.2.3.1.
+    - Fix a rare memory leak when checking the nodelist without it being
+      present. Found by coverity. Bugfix on 0.2.3.1.
   o Code simplifications and refactoring:
     - Remove a dead variable in the heartbeat log code. Spotted by coverity.
 
index 0856b3117c1f1981e865d1a96d1606074a994e56..8cded8f17dd7c3a00cb3496ebde09a1bc0c6eba8 100644 (file)
@@ -342,11 +342,13 @@ nodelist_assert_ok(void)
 {
   routerlist_t *rl = router_get_routerlist();
   networkstatus_t *ns = networkstatus_get_latest_consensus();
-  digestmap_t *dm = digestmap_new();
+  digestmap_t *dm;
 
   if (!the_nodelist)
     return;
 
+  dm = digestmap_new();
+
   /* every routerinfo in rl->routers should be in the nodelist. */
   if (rl) {
     SMARTLIST_FOREACH_BEGIN(rl->routers, routerinfo_t *, ri) {