]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix reference leak & handle leak in consensus_diff_worker_replyfn
authorNick Mathewson <nickm@torproject.org>
Sun, 16 Apr 2017 15:52:31 +0000 (11:52 -0400)
committerNick Mathewson <nickm@torproject.org>
Mon, 24 Apr 2017 15:01:40 +0000 (11:01 -0400)
Found by previous test.

src/or/consdiffmgr.c

index 240fe6e2da3f616e5f6a4823b187bc56b854538c..1c9c2a9932f54fa5a1bfc3c45d61b373fbc45c0c 100644 (file)
@@ -1058,6 +1058,7 @@ consensus_diff_worker_replyfn(void *work_)
                           job->bodylen_out);
     status = CDM_DIFF_PRESENT;
     handle = consensus_cache_entry_handle_new(ent);
+    consensus_cache_entry_decref(ent);
   } else {
     /* Failure! Nothing to do but complain */
     log_warn(LD_DIRSERV,
@@ -1069,6 +1070,9 @@ consensus_diff_worker_replyfn(void *work_)
 
   if (cache)
     cdm_diff_ht_set_status(flav, from_sha3, to_sha3, status, handle);
+  else
+    consensus_cache_entry_handle_free(handle);
+
   consensus_diff_worker_job_free(job);
 }