diff options
author | Nick Mathewson <nickm@torproject.org> | 2008-08-25 23:19:58 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2008-08-25 23:19:58 +0000 |
commit | 2625eb204f6998096ad701a03d1cfb82ec45cd31 (patch) | |
tree | 613cf89bed0418cef465198ef9a810ceb368d202 /src/or/networkstatus.c | |
parent | 8b4e9ba02cbeaff3a6df690368b0f83a8208a0fe (diff) | |
download | tor-2625eb204f6998096ad701a03d1cfb82ec45cd31.tar.gz tor-2625eb204f6998096ad701a03d1cfb82ec45cd31.zip |
Fix a memory leak when freeing routerstatuses with exit policy summaries. Patch from mwenge.
svn:r16659
Diffstat (limited to 'src/or/networkstatus.c')
-rw-r--r-- | src/or/networkstatus.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c index 5a2c72dc4b..889c0e70c5 100644 --- a/src/or/networkstatus.c +++ b/src/or/networkstatus.c @@ -233,10 +233,19 @@ router_reload_consensus_networkstatus(void) return 0; } +static void +vote_routerstatus_free(vote_routerstatus_t *rs) +{ + tor_free(rs->version); + tor_free(rs->status.exitsummary); + tor_free(rs); +} + /** Free all storage held by the routerstatus object <b>rs</b>. */ void routerstatus_free(routerstatus_t *rs) { + tor_free(rs->exitsummary); tor_free(rs); } @@ -292,13 +301,10 @@ networkstatus_vote_free(networkstatus_t *ns) if (ns->routerstatus_list) { if (ns->type == NS_TYPE_VOTE || ns->type == NS_TYPE_OPINION) { SMARTLIST_FOREACH(ns->routerstatus_list, vote_routerstatus_t *, rs, - { - tor_free(rs->version); - tor_free(rs); - }); + vote_routerstatus_free(rs)); } else { SMARTLIST_FOREACH(ns->routerstatus_list, routerstatus_t *, rs, - tor_free(rs)); + routerstatus_free(rs)); } smartlist_free(ns->routerstatus_list); |