Skip to content
Snippets Groups Projects
Commit b531fc7d authored by Nick Mathewson's avatar Nick Mathewson :game_die:
Browse files

Fix some memory issues in test_dns.c

parent 92a596d0
No related branches found
No related tags found
No related merge requests found
...@@ -103,7 +103,8 @@ send_resolved_hostname_cell_replacement(edge_connection_t *conn, ...@@ -103,7 +103,8 @@ send_resolved_hostname_cell_replacement(edge_connection_t *conn,
{ {
conn_for_resolved_cell = 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++; n_send_resolved_hostname_cell_replacement++;
} }
...@@ -179,7 +180,8 @@ test_dns_resolve_outer(void *arg) ...@@ -179,7 +180,8 @@ test_dns_resolve_outer(void *arg)
prev_n_send_resolved_hostname_cell_replacement + 1); prev_n_send_resolved_hostname_cell_replacement + 1);
tt_assert(exitconn->on_circuit == NULL); 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. /* CASE 2: dns_resolve_impl returns 1, but does not set hostname.
* Instead, it yields cached_resolve_t object. * Instead, it yields cached_resolve_t object.
...@@ -296,6 +298,7 @@ test_dns_resolve_outer(void *arg) ...@@ -296,6 +298,7 @@ test_dns_resolve_outer(void *arg)
tor_free(nextconn); tor_free(nextconn);
tor_free(resolved_name); tor_free(resolved_name);
tor_free(fake_resolved); tor_free(fake_resolved);
tor_free(last_resolved_hostname);
return; return;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment