summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-02-24 15:13:29 -0500
committerNick Mathewson <nickm@torproject.org>2016-02-24 15:13:29 -0500
commita3f764ea692cefa534d05e6e661b8b9c3a9e8429 (patch)
tree564653147c366e8e58f7d7931ae427c295fdda79
parentba0ddd7467329bb7b6b201c0bd11bf99abcd0d7e (diff)
downloadtor-a3f764ea692cefa534d05e6e661b8b9c3a9e8429.tar.gz
tor-a3f764ea692cefa534d05e6e661b8b9c3a9e8429.zip
Fix memory leaks in routerlist/pick_directory_server_impl test
-rw-r--r--src/test/test_routerlist.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/test/test_routerlist.c b/src/test/test_routerlist.c
index 31533d070f..8b37cc025a 100644
--- a/src/test/test_routerlist.c
+++ b/src/test/test_routerlist.c
@@ -30,7 +30,7 @@ extern const char AUTHORITY_SIGNKEY_2[];
extern const char AUTHORITY_CERT_3[];
extern const char AUTHORITY_SIGNKEY_3[];
-void construct_consensus(const char **consensus_text_md);
+void construct_consensus(char **consensus_text_md);
/* 4 digests + 3 sep + pre + post + NULL */
static char output[4*BASE64_DIGEST256_LEN+3+2+2+1];
@@ -120,7 +120,7 @@ test_routerlist_launch_descriptor_downloads(void *arg)
}
void
-construct_consensus(const char **consensus_text_md)
+construct_consensus(char **consensus_text_md)
{
networkstatus_t *vote = NULL;
networkstatus_t *v1 = NULL, *v2 = NULL, *v3 = NULL;
@@ -180,6 +180,14 @@ construct_consensus(const char **consensus_text_md)
networkstatus_vote_free(v1);
networkstatus_vote_free(v2);
networkstatus_vote_free(v3);
+ smartlist_free(votes);
+ authority_cert_free(cert1);
+ authority_cert_free(cert2);
+ authority_cert_free(cert3);
+ crypto_pk_free(sign_skey_1);
+ crypto_pk_free(sign_skey_2);
+ crypto_pk_free(sign_skey_3);
+ crypto_pk_free(sign_skey_leg);
}
static void
@@ -188,7 +196,7 @@ test_router_pick_directory_server_impl(void *arg)
(void)arg;
networkstatus_t *con_md = NULL;
- const char *consensus_text_md = NULL;
+ char *consensus_text_md = NULL;
int flags = PDS_IGNORE_FASCISTFIREWALL|PDS_RETRY_IF_NO_SERVERS;
or_options_t *options = get_options_mutable();
const routerstatus_t *rs = NULL;
@@ -363,6 +371,8 @@ test_router_pick_directory_server_impl(void *arg)
if (options->ReachableORAddresses ||
options->ReachableDirAddresses)
policies_free_all();
+ tor_free(consensus_text_md);
+ networkstatus_vote_free(con_md);
}
connection_t *mocked_connection = NULL;