diff options
author | Nick Mathewson <nickm@torproject.org> | 2015-05-29 14:08:51 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2015-05-29 14:08:51 -0400 |
commit | 10dd50dfcb19069465480c9cfdf57372123a0b3b (patch) | |
tree | e5b39afdbc0fc5ca26f265a324a1a67cc5cede56 | |
parent | 27bc0da14d1c9c91bfe31d88c862cd00972ab187 (diff) | |
download | tor-10dd50dfcb19069465480c9cfdf57372123a0b3b.tar.gz tor-10dd50dfcb19069465480c9cfdf57372123a0b3b.zip |
Fix a warning from the clangalyzer.
-rw-r--r-- | src/or/dirvote.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/or/dirvote.c b/src/or/dirvote.c index e037794fc7..0f3b77fe28 100644 --- a/src/or/dirvote.c +++ b/src/or/dirvote.c @@ -1143,6 +1143,7 @@ networkstatus_compute_consensus(smartlist_t *votes, dircollator_t *collator = NULL; tor_assert(flavor == FLAV_NS || flavor == FLAV_MICRODESC); tor_assert(total_authorities >= smartlist_len(votes)); + tor_assert(total_authorities > 0); flavor_name = networkstatus_get_flavor_name(flavor); @@ -1535,7 +1536,7 @@ networkstatus_compute_consensus(smartlist_t *votes, /* Okay, go through all the entries for this digest. */ for (int voter_idx = 0; voter_idx < smartlist_len(votes); ++voter_idx) { if (vrs_lst[voter_idx] == NULL) - continue; /* This voter had nothig to say about this entry. */ + continue; /* This voter had nothing to say about this entry. */ rs = vrs_lst[voter_idx]; ++n_listing; @@ -1579,6 +1580,10 @@ networkstatus_compute_consensus(smartlist_t *votes, if (n_listing <= total_authorities/2) continue; + /* The clangalyzer can't figure out that this will never be NULL + * if n_listing is at least 1 */ + tor_assert(current_rsa_id); + /* Figure out the most popular opinion of what the most recent * routerinfo and its contents are. */ memset(microdesc_digest, 0, sizeof(microdesc_digest)); |