[tor-commits] [tor/master] Another memory leak bytes the dust.

nickm at torproject.org nickm at torproject.org
Fri May 29 20:18:02 UTC 2015


commit 12a2321501753d1872daed2e036db05845ecc416
Author: Nick Mathewson <nickm at torproject.org>
Date:   Fri May 29 16:17:54 2015 -0400

    Another memory leak bytes the dust.
---
 src/or/routerkeys.c |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/or/routerkeys.c b/src/or/routerkeys.c
index 91de4db..a76bf99 100644
--- a/src/or/routerkeys.c
+++ b/src/or/routerkeys.c
@@ -312,12 +312,14 @@ load_ed_keys(const or_options_t *options, time_t now)
     check_signing_cert = signing_key_cert;
     use_signing = master_signing_key;
   } else {
+    char *fname = options_get_datadir_fname2(options, "keys", "ed25519_signing");
     sign = ed_key_init_from_file(
-               options_get_datadir_fname2(options, "keys", "ed25519_signing"),
+               fname,
                INIT_ED_KEY_NEEDCERT|
                INIT_ED_KEY_INCLUDE_SIGNING_KEY_IN_CERT,
                LOG_INFO,
                NULL, 0, 0, CERT_TYPE_ID_SIGNING, &sign_cert);
+    tor_free(fname);
     check_signing_cert = sign_cert;
     use_signing = sign;
   }
@@ -338,10 +340,12 @@ load_ed_keys(const or_options_t *options, time_t now)
     if (! want_new_signing_key)
       flags |= INIT_ED_KEY_OMIT_SECRET;
 
+    char *fname = options_get_datadir_fname2(options, "keys", "ed25519_master_id");
     id = ed_key_init_from_file(
-             options_get_datadir_fname2(options, "keys", "ed25519_master_id"),
+             fname,
              flags,
              LOG_WARN, NULL, 0, 0, 0, NULL);
+    tor_free(fname);
     if (!id)
       FAIL("Missing identity key");
     if (tor_mem_is_zero((char*)id->seckey.seckey, sizeof(id->seckey)))
@@ -359,12 +363,13 @@ load_ed_keys(const or_options_t *options, time_t now)
                       INIT_ED_KEY_EXTRA_STRONG|
                       INIT_ED_KEY_NEEDCERT|
                       INIT_ED_KEY_INCLUDE_SIGNING_KEY_IN_CERT);
-    sign = ed_key_init_from_file(
-               options_get_datadir_fname2(options, "keys", "ed25519_signing"),
+    char *fname = options_get_datadir_fname2(options, "keys", "ed25519_signing");
+    sign = ed_key_init_from_file(fname,
                                  flags, LOG_WARN,
                                  sign_signing_key_with_id, now,
                                  options->SigningKeyLifetime,
                                  CERT_TYPE_ID_SIGNING, &sign_cert);
+    tor_free(fname);
     if (!sign)
       FAIL("Missing signing key");
     use_signing = sign;



More information about the tor-commits mailing list