[tor-commits] [tor/release-0.3.5] Fix a memory leak on failure to create keys directory.

teor at torproject.org teor at torproject.org
Mon Aug 12 03:13:19 UTC 2019


commit 85ff6f9114eb2d492d88ed55d01a69f7bafb10be
Author: Nick Mathewson <nickm at torproject.org>
Date:   Thu Apr 11 18:18:14 2019 -0400

    Fix a memory leak on failure to create keys directory.
    
    Fixes bug 30148, which is also CID 1437429 and CID 1437454. Bugfix
    on 0.3.3.1-alpha, when separate key directories became a thing.
---
 changes/bug30148    | 4 ++++
 src/or/routerkeys.c | 3 +--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/changes/bug30148 b/changes/bug30148
new file mode 100644
index 000000000..7d0257e3f
--- /dev/null
+++ b/changes/bug30148
@@ -0,0 +1,4 @@
+  o Minor bugfixes (memory leak):
+    - Avoid a minor memory leak that could occur on relays when
+      creating a keys directory failed. Fixes bug 30148; bugfix on
+      0.3.3.1-alpha.
diff --git a/src/or/routerkeys.c b/src/or/routerkeys.c
index 43460da8c..dd19d28d0 100644
--- a/src/or/routerkeys.c
+++ b/src/or/routerkeys.c
@@ -816,7 +816,7 @@ load_ed_keys(const or_options_t *options, time_t now)
 
     /* Check/Create the key directory */
     if (create_keys_directory(options) < 0)
-      return -1;
+      goto err;
 
     char *fname;
     if (options->master_key_fname) {
@@ -1403,4 +1403,3 @@ routerkeys_free_all(void)
   rsa_ed_crosscert = NULL; // redundant
   rsa_ed_crosscert_len = 0;
 }
-





More information about the tor-commits mailing list