]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Don't leak a waiting-for-certs consensus when accepting it.
authorNick Mathewson <nickm@torproject.org>
Wed, 17 Apr 2013 15:53:52 +0000 (11:53 -0400)
committerNick Mathewson <nickm@torproject.org>
Wed, 17 Apr 2013 15:53:52 +0000 (11:53 -0400)
I believe this was introduced in 6bc071f765d2829249db52, which makes
this a fix on 0.2.0.10-alpha.  But my code archeology has not extended
to actually testing that theory.

changes/bug8719 [new file with mode: 0644]
src/or/networkstatus.c

diff --git a/changes/bug8719 b/changes/bug8719
new file mode 100644 (file)
index 0000000..c05b79d
--- /dev/null
@@ -0,0 +1,6 @@
+  o Major bugfixes (memory leak):
+    - Avoid a memory leak where we would leak a consensus body when we find
+      that a consensus which we couldn't previously verify due to missing
+      certificates is now verifiable. Fixes bug 8719; bugfix on
+      0.2.0.10-alpha.
+
index 2553a74e50662026d89752efe8845ecf1e6a0821..b78fed3111edc137408cb2c5e72b97de30c04032 100644 (file)
@@ -1893,11 +1893,12 @@ networkstatus_note_certs_arrived(void)
     if (!waiting->consensus)
       continue;
     if (networkstatus_check_consensus_signature(waiting->consensus, 0)>=0) {
+      char *waiting_body = waiting->body;
       if (!networkstatus_set_current_consensus(
-                                 waiting->body,
+                                 waiting_body,
                                  networkstatus_get_flavor_name(i),
                                  NSSET_WAS_WAITING_FOR_CERTS)) {
-        tor_free(waiting->body);
+        tor_free(waiting_body);
       }
     }
   }