diff options
author | George Kadianakis <desnacked@riseup.net> | 2017-08-29 18:29:05 +0300 |
---|---|---|
committer | George Kadianakis <desnacked@riseup.net> | 2017-09-15 12:46:26 +0300 |
commit | 5cc80692b8397d8b87fd69d0f0165a6156534f0b (patch) | |
tree | 39d941483b9f2f573aa437db385450be62964b31 | |
parent | e9b4624cc589d830d7a78128649f7945ac808737 (diff) | |
download | tor-5cc80692b8397d8b87fd69d0f0165a6156534f0b.tar.gz tor-5cc80692b8397d8b87fd69d0f0165a6156534f0b.zip |
prop224: Fix memleak in client_get_random_intro().
The memleak was occuring because of the way ExcludeNodes is handled in
that function. Basically, we were putting excluded intro points extend
infos in a special variable which was never freed. Also, if there were
multiple excluded intro points then that variable was overwritten
everytime leaking more memory. This commit should fix both issues.
-rw-r--r-- | src/or/hs_client.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/or/hs_client.c b/src/or/hs_client.c index 19359d260e..77fbf548ed 100644 --- a/src/or/hs_client.c +++ b/src/or/hs_client.c @@ -646,6 +646,12 @@ client_get_random_intro(const ed25519_public_key_t *service_pk) /* If this pick is in the ExcludeNodes list, we keep its reference so if * we ever end up not being able to pick anything else and StrictNodes is * unset, we'll use it. */ + if (ei_excluded) { + /* If something was already here free it. After the loop is gone we + * will examine the last excluded intro point, and that's fine since + * that's random anyway */ + extend_info_free(ei_excluded); + } ei_excluded = ei; continue; } @@ -662,6 +668,7 @@ client_get_random_intro(const ed25519_public_key_t *service_pk) if (options->StrictNodes) { log_warn(LD_REND, "Every introduction points are in the ExcludeNodes set " "and StrictNodes is set. We can't connect."); + extend_info_free(ei); ei = NULL; } |