diff options
Diffstat (limited to 'src/or/networkstatus.c')
-rw-r--r-- | src/or/networkstatus.c | 42 |
1 files changed, 16 insertions, 26 deletions
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c index c8bb03357f..f3925f1b89 100644 --- a/src/or/networkstatus.c +++ b/src/or/networkstatus.c @@ -361,8 +361,7 @@ networkstatus_vote_free(networkstatus_t *ns) } SMARTLIST_FOREACH_END(voter); smartlist_free(ns->voters); } - if (ns->cert) - authority_cert_free(ns->cert); + authority_cert_free(ns->cert); if (ns->routerstatus_list) { if (ns->type == NS_TYPE_VOTE || ns->type == NS_TYPE_OPINION) { @@ -375,8 +374,8 @@ networkstatus_vote_free(networkstatus_t *ns) smartlist_free(ns->routerstatus_list); } - if (ns->desc_digest_map) - digestmap_free(ns->desc_digest_map, NULL); + + digestmap_free(ns->desc_digest_map, NULL); memset(ns, 11, sizeof(*ns)); tor_free(ns); @@ -1592,8 +1591,7 @@ networkstatus_set_current_consensus(const char *consensus, if (!current_valid_after || c->valid_after > current_valid_after) { waiting = &consensus_waiting_for_certs[flav]; - if (waiting->consensus) - networkstatus_vote_free(waiting->consensus); + networkstatus_vote_free(waiting->consensus); tor_free(waiting->body); waiting->consensus = c; c = NULL; /* Prevent free. */ @@ -1705,8 +1703,7 @@ networkstatus_set_current_consensus(const char *consensus, result = 0; done: - if (c) - networkstatus_vote_free(c); + networkstatus_vote_free(c); tor_free(consensus_fname); tor_free(unverified_fname); return result; @@ -1838,11 +1835,9 @@ routerstatus_list_update_named_server_map(void) if (!current_consensus) return; - if (named_server_map) - strmap_free(named_server_map, _tor_free); + strmap_free(named_server_map, _tor_free); named_server_map = strmap_new(); - if (unnamed_server_map) - strmap_free(unnamed_server_map, NULL); + strmap_free(unnamed_server_map, NULL); unnamed_server_map = strmap_new(); SMARTLIST_FOREACH(current_consensus->routerstatus_list, routerstatus_t *, rs, { @@ -2159,14 +2154,12 @@ networkstatus_free_all(void) smartlist_free(networkstatus_v2_list); networkstatus_v2_list = NULL; } - if (v2_download_status_map) { - digestmap_free(v2_download_status_map, _tor_free); - v2_download_status_map = NULL; - } - if (current_consensus) { - networkstatus_vote_free(current_consensus); - current_consensus = NULL; - } + + digestmap_free(v2_download_status_map, _tor_free); + v2_download_status_map = NULL; + networkstatus_vote_free(current_consensus); + current_consensus = NULL; + for (i=0; i < N_CONSENSUS_FLAVORS; ++i) { consensus_waiting_for_certs_t *waiting = &consensus_waiting_for_certs[i]; if (waiting->consensus) { @@ -2175,11 +2168,8 @@ networkstatus_free_all(void) } tor_free(waiting->body); } - if (named_server_map) { - strmap_free(named_server_map, _tor_free); - } - if (unnamed_server_map) { - strmap_free(unnamed_server_map, NULL); - } + + strmap_free(named_server_map, _tor_free); + strmap_free(unnamed_server_map, NULL); } |