diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-09-12 21:09:18 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-09-12 21:32:42 -0400 |
commit | 4ff170d7b1cbe4074cb85271b82a8963eccc8286 (patch) | |
tree | 459640c64a49ee1342338647cd67570cac605516 /src/or/dirvote.c | |
parent | 491b6de1684e519d1fec870a5b46a4bb540cbc13 (diff) | |
download | tor-4ff170d7b1cbe4074cb85271b82a8963eccc8286.tar.gz tor-4ff170d7b1cbe4074cb85271b82a8963eccc8286.zip |
Fix warnings about passing uninitialized buffers into functions
Most of these buffers were never actually inspected, but it's still
bad style.
Diffstat (limited to 'src/or/dirvote.c')
-rw-r--r-- | src/or/dirvote.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/or/dirvote.c b/src/or/dirvote.c index 5dd2179521..ba0ab7a776 100644 --- a/src/or/dirvote.c +++ b/src/or/dirvote.c @@ -3993,14 +3993,15 @@ dirvote_format_all_microdesc_vote_lines(const routerinfo_t *ri, time_t now, while ((ep = entries)) { char buf[128]; vote_microdesc_hash_t *h; - dirvote_format_microdesc_vote_line(buf, sizeof(buf), ep->md, - ep->low, ep->high); - h = tor_malloc_zero(sizeof(vote_microdesc_hash_t)); - h->microdesc_hash_line = tor_strdup(buf); - h->next = result; - result = h; - ep->md->last_listed = now; - smartlist_add(microdescriptors_out, ep->md); + if (dirvote_format_microdesc_vote_line(buf, sizeof(buf), ep->md, + ep->low, ep->high) >= 0) { + h = tor_malloc_zero(sizeof(vote_microdesc_hash_t)); + h->microdesc_hash_line = tor_strdup(buf); + h->next = result; + result = h; + ep->md->last_listed = now; + smartlist_add(microdescriptors_out, ep->md); + } entries = ep->next; tor_free(ep); } |