r12553@catbus: nickm | 2007-04-30 01:32:54 -0400

Backport candidate:  Add asserts to dirserv_remove_invalid, and fix a bug in dirserv_remove_invalid that could mess with pointers in a freed routerinfo right after it was freed.


svn:r10052
This commit is contained in:
Nick Mathewson
2007-04-30 05:32:57 +00:00
parent 743a8cf0eb
commit f7acc3cfa0
3 changed files with 9 additions and 1 deletions
+5
View File
@@ -621,6 +621,8 @@ directory_remove_invalid(void)
int changed = 0;
routerlist_t *rl = router_get_routerlist();
routerlist_assert_ok(rl);
for (i = 0; i < smartlist_len(rl->routers); ++i) {
const char *msg;
routerinfo_t *ent = smartlist_get(rl->routers, i);
@@ -630,6 +632,7 @@ directory_remove_invalid(void)
ent->nickname, msg?msg:"");
routerlist_remove(rl, ent, i--, 0);
changed = 1;
continue;
}
if (bool_neq((r & FP_NAMED), ent->is_named)) {
log_info(LD_DIRSERV,
@@ -653,6 +656,8 @@ directory_remove_invalid(void)
}
if (changed)
directory_set_dirty();
routerlist_assert_ok(rl);
}
/** Write a list of unregistered descriptors into a newly allocated