]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
dirvote: Fix memleak when computing consensus
authorDavid Goulet <dgoulet@torproject.org>
Mon, 5 Aug 2024 15:59:30 +0000 (11:59 -0400)
committerDavid Goulet <dgoulet@torproject.org>
Mon, 5 Aug 2024 15:59:30 +0000 (11:59 -0400)
Fixes #40966

Signed-off-by: David Goulet <dgoulet@torproject.org>
changes/ticket40966 [new file with mode: 0644]
src/feature/dirauth/dirvote.c

diff --git a/changes/ticket40966 b/changes/ticket40966
new file mode 100644 (file)
index 0000000..04fb3ca
--- /dev/null
@@ -0,0 +1,3 @@
+  o Minor bugfixes (memleak, authority):
+    - Fix a small memleak when computing a new consensus. This only affects
+      directory authorities. Fixes bug 40966; bugfix on 0.3.5.1-alpha.
index 1080415827673e3052966d14cb09669bdc2e9155..0783fb1e91d4b4a97313204da027dfc41e8278d1 100644 (file)
@@ -3543,8 +3543,10 @@ dirvote_compute_consensuses(void)
       {
         char *filename;
         tor_asprintf(&filename, "my-consensus-%s", flavor_name);
-        write_str_to_file(get_datadir_fname(filename), consensus_body, 0);
+        char *fpath = get_datadir_fname(filename);
+        write_str_to_file(fpath, consensus_body, 0);
         tor_free(filename);
+        tor_free(fpath);
       }
 
       consensus_body = NULL;