[or-cvs] r12620: fix two trivial potential onionkey leaks. neither of these s (tor/trunk/src/or)

arma at seul.org arma at seul.org
Sat Dec 1 04:40:12 UTC 2007


Author: arma
Date: 2007-11-30 23:40:12 -0500 (Fri, 30 Nov 2007)
New Revision: 12620

Modified:
   tor/trunk/src/or/router.c
Log:
fix two trivial potential onionkey leaks. neither of these
should happen in practice. but now they really won't.


Modified: tor/trunk/src/or/router.c
===================================================================
--- tor/trunk/src/or/router.c	2007-11-30 23:45:16 UTC (rev 12619)
+++ tor/trunk/src/or/router.c	2007-12-01 04:40:12 UTC (rev 12620)
@@ -189,6 +189,8 @@
   goto done;
  error:
   log_warn(LD_GENERAL, "Couldn't rotate onion key.");
+  if (prkey)
+    crypto_free_pk_env(prkey);
  done:
   tor_free(fname);
   tor_free(fname_prev);
@@ -469,7 +471,7 @@
   }
 
   keydir = get_datadir_fname2("keys", "secret_onion_key.old");
-  if (file_status(keydir) == FN_FILE) {
+  if (!lastonionkey && file_status(keydir) == FN_FILE) {
     prkey = init_key_from_file(keydir, 1, LOG_ERR);
     if (prkey)
       lastonionkey = prkey;



More information about the tor-commits mailing list