[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Fix an unreachable memory leak.



commit e1418c09fc2609c4c43b0eebb6b6676139573a02
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Tue Mar 7 11:47:19 2017 -0500

    Fix an unreachable memory leak.
    
    Also add a missing newline.
---
 src/or/consdiff.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/or/consdiff.c b/src/or/consdiff.c
index a3006ce..f8cf180 100644
--- a/src/or/consdiff.c
+++ b/src/or/consdiff.c
@@ -832,14 +832,18 @@ consdiff_gen_diff(smartlist_t *cons1, smartlist_t *cons2,
   smartlist_t *result = smartlist_new();
   smartlist_add_asprintf(result, "%s", ns_diff_version);
   smartlist_add_asprintf(result, "%s %s %s", hash_token,
-      cons1_hash_hex, cons2_hash_hex); smartlist_add_all(result, ed_diff);
+      cons1_hash_hex, cons2_hash_hex);
+  smartlist_add_all(result, ed_diff);
   smartlist_free(ed_diff);
   return result;
 
  error_cleanup:
 
   if (ed_diff) {
+    /* LCOV_EXCL_START -- ed_diff is NULL except in unreachable cases above */
+    SMARTLIST_FOREACH(ed_diff, char *, cp, tor_free(cp));
     smartlist_free(ed_diff);
+    /* LCOV_EXCL_STOP */
   }
 
   return NULL;



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits