]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix a memory leak found while fuzzing
authorNick Mathewson <nickm@torproject.org>
Mon, 9 Jan 2017 19:25:48 +0000 (14:25 -0500)
committerNick Mathewson <nickm@torproject.org>
Mon, 30 Jan 2017 13:37:26 +0000 (08:37 -0500)
src/or/routerparse.c

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