[tor-commits] [tor/master] Fix a memory leak found while fuzzing

nickm at torproject.org nickm at torproject.org
Mon Jan 30 13:45:47 UTC 2017


commit a092bcdd4f619e9b08ebb09049b4dd6cbdb3ee1c
Author: Nick Mathewson <nickm at torproject.org>
Date:   Mon Jan 9 14:25:48 2017 -0500

    Fix a memory leak found while fuzzing
---
 src/or/routerparse.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 0aa953c..8cdeb45 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -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;





More information about the tor-commits mailing list