commit 1edaef2adfe7c929f4fb2bfa1c3519e3f28297ce Author: Nick Mathewson nickm@torproject.org Date: Fri Jun 19 09:03:25 2015 -0400
fix some memory leaks that coverity found --- src/or/routerkeys.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/or/routerkeys.c b/src/or/routerkeys.c index f5cae44..2fd7f41 100644 --- a/src/or/routerkeys.c +++ b/src/or/routerkeys.c @@ -29,10 +29,11 @@ read_encrypted_secret_key(ed25519_secret_key_t *out, sizeof(encrypted_key)); if (encrypted_len < 0) { log_info(LD_OR, "%s is missing", fname); - return 0; + r = 0; + goto done; } if (strcmp(tag, ENC_KEY_TAG)) - return -1; + goto done;
while (1) { ssize_t pwlen = @@ -64,6 +65,7 @@ read_encrypted_secret_key(ed25519_secret_key_t *out, done: memwipe(encrypted_key, 0, encrypted_len); memwipe(pwbuf, 0, sizeof(pwbuf)); + tor_free(tag); if (secret) { memwipe(secret, 0, secret_len); tor_free(secret); @@ -498,6 +500,7 @@ load_ed_keys(const or_options_t *options, time_t now) tor_free(fname); goto err; } + tor_free(fname); fname = options_get_datadir_fname2(options, "keys", "ed25519_master_id"); id = ed_key_init_from_file( fname,
tor-commits@lists.torproject.org