From 0b8117a5c002b262b6ee56acc3719700637416c7 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 5 Sep 2008 20:52:15 +0000 Subject: Fix numerous memory leaks: some were almost impossible to trigger, and some almost inevitable. svn:r16779 --- src/or/rendservice.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/or/rendservice.c') 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; -- cgit v1.2.3-54-g00ecf