Fix a memory leak found while fuzzing

This commit is contained in:
Nick Mathewson 2017-01-09 14:25:48 -05:00
parent 09d01466b2
commit a092bcdd4f

View File

@ -3711,11 +3711,10 @@ networkstatus_parse_vote_from_string(const char *s, const char **eos_out,
if (ns->type != NS_TYPE_CONSENSUS) { if (ns->type != NS_TYPE_CONSENSUS) {
vote_routerstatus_t *rs = tor_malloc_zero(sizeof(vote_routerstatus_t)); vote_routerstatus_t *rs = tor_malloc_zero(sizeof(vote_routerstatus_t));
if (routerstatus_parse_entry_from_string(rs_area, &s, rs_tokens, ns, if (routerstatus_parse_entry_from_string(rs_area, &s, rs_tokens, ns,
rs, 0, 0)) rs, 0, 0)) {
smartlist_add(ns->routerstatus_list, rs); smartlist_add(ns->routerstatus_list, rs);
else { } else {
tor_free(rs->version); vote_routerstatus_free(rs);
tor_free(rs);
} }
} else { } else {
routerstatus_t *rs; routerstatus_t *rs;