diff options
author | Nick Mathewson <nickm@torproject.org> | 2008-09-05 20:52:15 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2008-09-05 20:52:15 +0000 |
commit | 0b8117a5c002b262b6ee56acc3719700637416c7 (patch) | |
tree | 73746b443d10620630933d7de5d0f467378fb5d7 /src/or/rendservice.c | |
parent | 4d94e061c7a1af2fbb92ab3114c3ce5f59971a31 (diff) | |
download | tor-0b8117a5c002b262b6ee56acc3719700637416c7.tar.gz tor-0b8117a5c002b262b6ee56acc3719700637416c7.zip |
Fix numerous memory leaks: some were almost impossible to trigger, and some almost inevitable.
svn:r16779
Diffstat (limited to 'src/or/rendservice.c')
-rw-r--r-- | src/or/rendservice.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/or/rendservice.c b/src/or/rendservice.c index 5f0430bef0..aeefbd84f4 100644 --- a/src/or/rendservice.c +++ b/src/or/rendservice.c @@ -638,6 +638,7 @@ rend_service_load_keys(void) } if (crypto_pk_generate_key(prkey)) { log_warn(LD_BUG,"Error generating client key"); + crypto_free_pk_env(prkey); goto err; } if (crypto_pk_check_key(prkey) <= 0) { @@ -657,15 +658,17 @@ rend_service_load_keys(void) goto err; } if (client->client_key) { - char *client_key_out; + char *client_key_out = NULL; crypto_pk_write_private_key_to_string(client->client_key, &client_key_out, &len); if (rend_get_service_id(client->client_key, service_id)<0) { log_warn(LD_BUG, "Internal error: couldn't encode service ID."); + tor_free(client_key_out); goto err; } written = tor_snprintf(buf + written, sizeof(buf) - written, "client-key\n%s", client_key_out); + tor_free(client_key_out); if (written < 0) { log_warn(LD_BUG, "Could not write client entry."); goto err; |