aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_dns.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-08-26 11:41:25 -0400
committerNick Mathewson <nickm@torproject.org>2015-08-26 11:41:25 -0400
commitb531fc7d9a8f75969b0446578ee4afcb109bae3d (patch)
treef54339abdf5ec326661ddad51b6eea1142eff0d7 /src/test/test_dns.c
parent92a596d0fce4b07aed854001b2f6718692f7a4eb (diff)
downloadtor-b531fc7d9a8f75969b0446578ee4afcb109bae3d.tar.gz
tor-b531fc7d9a8f75969b0446578ee4afcb109bae3d.zip
Fix some memory issues in test_dns.c
Diffstat (limited to 'src/test/test_dns.c')
-rw-r--r--src/test/test_dns.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/test/test_dns.c b/src/test/test_dns.c
index fba38faa91..ad81914ccb 100644
--- a/src/test/test_dns.c
+++ b/src/test/test_dns.c
@@ -103,7 +103,8 @@ send_resolved_hostname_cell_replacement(edge_connection_t *conn,
{
conn_for_resolved_cell = conn;
- last_resolved_hostname = (char *)hostname;
+ tor_free(last_resolved_hostname);
+ last_resolved_hostname = tor_strdup(hostname);
n_send_resolved_hostname_cell_replacement++;
}
@@ -179,7 +180,8 @@ test_dns_resolve_outer(void *arg)
prev_n_send_resolved_hostname_cell_replacement + 1);
tt_assert(exitconn->on_circuit == NULL);
- last_resolved_hostname = NULL;
+ tor_free(last_resolved_hostname);
+ // implies last_resolved_hostname = NULL;
/* CASE 2: dns_resolve_impl returns 1, but does not set hostname.
* Instead, it yields cached_resolve_t object.
@@ -296,6 +298,7 @@ test_dns_resolve_outer(void *arg)
tor_free(nextconn);
tor_free(resolved_name);
tor_free(fake_resolved);
+ tor_free(last_resolved_hostname);
return;
}