Fix a memleak in nodelist_assert_ok()

This commit is contained in:
Sebastian Hahn 2011-06-08 21:38:42 +02:00
parent 3033f8459b
commit 8283767365
2 changed files with 5 additions and 1 deletions

View File

@ -1,6 +1,8 @@
o Minor bugfixes: o Minor bugfixes:
- Prevent using negative indices during unit test runs when read_all() - Prevent using negative indices during unit test runs when read_all()
fails. Spotted by coverity. Bugfix on 0.2.3.1. 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: o Code simplifications and refactoring:
- Remove a dead variable in the heartbeat log code. Spotted by coverity. - Remove a dead variable in the heartbeat log code. Spotted by coverity.

View File

@ -342,11 +342,13 @@ nodelist_assert_ok(void)
{ {
routerlist_t *rl = router_get_routerlist(); routerlist_t *rl = router_get_routerlist();
networkstatus_t *ns = networkstatus_get_latest_consensus(); networkstatus_t *ns = networkstatus_get_latest_consensus();
digestmap_t *dm = digestmap_new(); digestmap_t *dm;
if (!the_nodelist) if (!the_nodelist)
return; return;
dm = digestmap_new();
/* every routerinfo in rl->routers should be in the nodelist. */ /* every routerinfo in rl->routers should be in the nodelist. */
if (rl) { if (rl) {
SMARTLIST_FOREACH_BEGIN(rl->routers, routerinfo_t *, ri) { SMARTLIST_FOREACH_BEGIN(rl->routers, routerinfo_t *, ri) {