[tor-commits] [tor/master] Fix a memleak in nodelist_assert_ok()

nickm at torproject.org nickm at torproject.org
Thu Jun 9 00:29:32 UTC 2011


commit 82837673655151609462d529986a310e04f1ba50
Author: Sebastian Hahn <sebastian at torproject.org>
Date:   Wed Jun 8 21:38:42 2011 +0200

    Fix a memleak in nodelist_assert_ok()
---
 changes/coverity_master |    2 ++
 src/or/nodelist.c       |    4 +++-
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/changes/coverity_master b/changes/coverity_master
index ab174bc..784dec3 100644
--- a/changes/coverity_master
+++ b/changes/coverity_master
@@ -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.
 
diff --git a/src/or/nodelist.c b/src/or/nodelist.c
index 0856b31..8cded8f 100644
--- a/src/or/nodelist.c
+++ b/src/or/nodelist.c
@@ -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) {





More information about the tor-commits mailing list