]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix an unreachable memory leak.
authorNick Mathewson <nickm@torproject.org>
Tue, 7 Mar 2017 16:47:19 +0000 (11:47 -0500)
committerNick Mathewson <nickm@torproject.org>
Thu, 16 Mar 2017 18:38:29 +0000 (14:38 -0400)
Also add a missing newline.

src/or/consdiff.c

index a3006ce0c5f80d80cf63770bc7bc5b74236bc90d..f8cf18040226171b40f6e9c31b875b5ca798710a 100644 (file)
@@ -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;