summaryrefslogtreecommitdiff
path: root/src/or/router.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-01-16 05:27:19 +0000
committerNick Mathewson <nickm@torproject.org>2008-01-16 05:27:19 +0000
commit4a3b7496f0c47b0d00c9744698eaa237e601b32a (patch)
treefdefeb3c864306cc52f3e9f5dadb8414f8a99187 /src/or/router.c
parent24aae484c93b09c7fc735e53874f02a22e4b5b43 (diff)
downloadtor-4a3b7496f0c47b0d00c9744698eaa237e601b32a.tar.gz
tor-4a3b7496f0c47b0d00c9744698eaa237e601b32a.zip
r17639@catbus: nickm | 2008-01-15 19:09:21 -0500
Fix some hard to trigger but nonetheless real memory leaks spotted by an anonymous contributor. Needs review. Partial backport candidate. svn:r13147
Diffstat (limited to 'src/or/router.c')
-rw-r--r--src/or/router.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/or/router.c b/src/or/router.c
index 9d4c3fdd18..8851fb0d34 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -397,8 +397,10 @@ init_keys(void)
if (!server_mode(options)) {
if (!(prkey = crypto_new_pk_env()))
return -1;
- if (crypto_pk_generate_key(prkey))
+ if (crypto_pk_generate_key(prkey)) {
+ crypto_free_pk_env(prkey);
return -1;
+ }
set_identity_key(prkey);
/* Create a TLS context; default the client nickname to "client". */
if (tor_tls_context_new(get_identity_key(),
@@ -1302,6 +1304,7 @@ router_rebuild_descriptor(int force)
if (extrainfo_dump_to_string(ei->cache_info.signed_descriptor_body, 8192,
ei, get_identity_key()) < 0) {
log_warn(LD_BUG, "Couldn't generate extra-info descriptor.");
+ extrainfo_free(ei);
return -1;
}
ei->cache_info.signed_descriptor_len =