aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test-timers.c2
-rw-r--r--src/test/test.c6
-rw-r--r--src/test/test_address.c16
-rw-r--r--src/test/test_cell_queue.c4
-rw-r--r--src/test/test_channel.c2
-rw-r--r--src/test/test_circuitlist.c28
-rw-r--r--src/test/test_dir.c6
-rw-r--r--src/test/test_dir_handle_get.c96
-rw-r--r--src/test/test_dns.c6
-rw-r--r--src/test/test_entryconn.c34
-rw-r--r--src/test/test_entrynodes.c4
-rw-r--r--src/test/test_extorport.c10
-rw-r--r--src/test/test_handles.c2
-rw-r--r--src/test/test_hs_cache.c2
-rw-r--r--src/test/test_hs_client.c12
-rw-r--r--src/test/test_hs_intropoint.c38
-rw-r--r--src/test/test_hs_service.c16
-rw-r--r--src/test/test_link_handshake.c14
-rw-r--r--src/test/test_oom.c2
-rw-r--r--src/test/test_policy.c8
-rw-r--r--src/test/test_rendcache.c8
-rw-r--r--src/test/test_replay.c2
-rw-r--r--src/test/test_routerlist.c2
-rw-r--r--src/test/test_routerset.c56
-rw-r--r--src/test/test_shared_random.c2
25 files changed, 190 insertions, 188 deletions
diff --git a/src/test/test-timers.c b/src/test/test-timers.c
index 99715f4333..a0b5b535c2 100644
--- a/src/test/test-timers.c
+++ b/src/test/test-timers.c
@@ -133,7 +133,7 @@ main(int argc, char **argv)
ret = 0;
}
- timer_free(NULL);
+ timer_free_(NULL);
for (i = 0; i < N_TIMERS; ++i) {
timer_free(timers[i]);
diff --git a/src/test/test.c b/src/test/test.c
index 432df35c34..c2e285635c 100644
--- a/src/test/test.c
+++ b/src/test/test.c
@@ -345,8 +345,8 @@ test_onion_queues(void *arg)
tt_int_op(0,OP_EQ, onion_num_pending(ONION_HANDSHAKE_TYPE_NTOR));
done:
- circuit_free(TO_CIRCUIT(circ1));
- circuit_free(TO_CIRCUIT(circ2));
+ circuit_free_(TO_CIRCUIT(circ1));
+ circuit_free_(TO_CIRCUIT(circ2));
tor_free(create1);
tor_free(create2);
tor_free(onionskin);
@@ -616,7 +616,7 @@ test_rend_fns(void *arg)
done:
if (descs) {
for (i = 0; i < smartlist_len(descs); i++)
- rend_encoded_v2_service_descriptor_free(smartlist_get(descs, i));
+ rend_encoded_v2_service_descriptor_free_(smartlist_get(descs, i));
smartlist_free(descs);
}
if (parsed)
diff --git a/src/test/test_address.c b/src/test/test_address.c
index f36ff6998b..9c88d37a41 100644
--- a/src/test/test_address.c
+++ b/src/test/test_address.c
@@ -763,7 +763,7 @@ test_address_get_if_addrs_list_internal(void *arg)
tt_assert(!smartlist_contains_ipv6_tor_addr(results));
done:
- free_interface_address_list(results);
+ interface_address_list_free(results);
return;
}
@@ -792,7 +792,7 @@ test_address_get_if_addrs_list_no_internal(void *arg)
tt_assert(!smartlist_contains_ipv6_tor_addr(results));
done:
- free_interface_address_list(results);
+ interface_address_list_free(results);
return;
}
@@ -834,7 +834,7 @@ test_address_get_if_addrs6_list_internal(void *arg)
}
done:
- free_interface_address6_list(results);
+ interface_address6_list_free(results);
teardown_capture_of_logs();
return;
}
@@ -878,7 +878,7 @@ test_address_get_if_addrs6_list_no_internal(void *arg)
done:
teardown_capture_of_logs();
- free_interface_address6_list(results);
+ interface_address6_list_free(results);
return;
}
@@ -943,8 +943,8 @@ test_address_get_if_addrs_internal_fail(void *arg)
done:
UNMOCK(get_interface_addresses_raw);
UNMOCK(get_interface_address6_via_udp_socket_hack);
- free_interface_address6_list(results1);
- free_interface_address6_list(results2);
+ interface_address6_list_free(results1);
+ interface_address6_list_free(results2);
return;
}
@@ -971,8 +971,8 @@ test_address_get_if_addrs_no_internal_fail(void *arg)
done:
UNMOCK(get_interface_addresses_raw);
UNMOCK(get_interface_address6_via_udp_socket_hack);
- free_interface_address6_list(results1);
- free_interface_address6_list(results2);
+ interface_address6_list_free(results1);
+ interface_address6_list_free(results2);
return;
}
diff --git a/src/test/test_cell_queue.c b/src/test/test_cell_queue.c
index 69e89b69b0..df987f82ce 100644
--- a/src/test/test_cell_queue.c
+++ b/src/test/test_cell_queue.c
@@ -130,8 +130,8 @@ test_circuit_n_cells(void *arg)
tt_int_op(n_cells_in_circ_queues(TO_CIRCUIT(origin_c)), OP_EQ, 2);
done:
- circuit_free(TO_CIRCUIT(or_c));
- circuit_free(TO_CIRCUIT(origin_c));
+ circuit_free_(TO_CIRCUIT(or_c));
+ circuit_free_(TO_CIRCUIT(origin_c));
}
struct testcase_t cell_queue_tests[] = {
diff --git a/src/test/test_channel.c b/src/test/test_channel.c
index 38b69a9ad3..55d43a04e5 100644
--- a/src/test/test_channel.c
+++ b/src/test/test_channel.c
@@ -654,7 +654,7 @@ test_channel_outbound_cell(void *arg)
done:
if (circ) {
- circuit_free(TO_CIRCUIT(circ));
+ circuit_free_(TO_CIRCUIT(circ));
}
tor_free(p_cell);
channel_free_all();
diff --git a/src/test/test_circuitlist.c b/src/test/test_circuitlist.c
index f622704ec5..d170009a9c 100644
--- a/src/test/test_circuitlist.c
+++ b/src/test/test_circuitlist.c
@@ -141,7 +141,7 @@ test_clist_maps(void *arg)
/* Okay, now free ch2 and make sure that the circuit ID is STILL not
* usable, because we haven't declared the destroy to be nonpending */
tt_int_op(cdm.ncalls, OP_EQ, 0);
- circuit_free(TO_CIRCUIT(or_c2));
+ circuit_free_(TO_CIRCUIT(or_c2));
or_c2 = NULL; /* prevent free */
tt_int_op(cdm.ncalls, OP_EQ, 2);
memset(&cdm, 0, sizeof(cdm));
@@ -160,9 +160,9 @@ test_clist_maps(void *arg)
done:
if (or_c1)
- circuit_free(TO_CIRCUIT(or_c1));
+ circuit_free_(TO_CIRCUIT(or_c1));
if (or_c2)
- circuit_free(TO_CIRCUIT(or_c2));
+ circuit_free_(TO_CIRCUIT(or_c2));
if (ch1)
tor_free(ch1->cmux);
if (ch2)
@@ -234,11 +234,11 @@ test_rend_token_maps(void *arg)
/* Marking a circuit makes it not get returned any more */
circuit_mark_for_close(TO_CIRCUIT(c1), END_CIRC_REASON_FINISHED);
tt_ptr_op(NULL, OP_EQ, hs_circuitmap_get_rend_circ_relay_side(tok1));
- circuit_free(TO_CIRCUIT(c1));
+ circuit_free_(TO_CIRCUIT(c1));
c1 = NULL;
/* Freeing a circuit makes it not get returned any more. */
- circuit_free(TO_CIRCUIT(c2));
+ circuit_free_(TO_CIRCUIT(c2));
c2 = NULL;
tt_ptr_op(NULL, OP_EQ, hs_circuitmap_get_intro_circ_v2_relay_side(tok2));
@@ -275,15 +275,15 @@ test_rend_token_maps(void *arg)
done:
if (c1)
- circuit_free(TO_CIRCUIT(c1));
+ circuit_free_(TO_CIRCUIT(c1));
if (c2)
- circuit_free(TO_CIRCUIT(c2));
+ circuit_free_(TO_CIRCUIT(c2));
if (c3)
- circuit_free(TO_CIRCUIT(c3));
+ circuit_free_(TO_CIRCUIT(c3));
if (c4)
- circuit_free(TO_CIRCUIT(c4));
+ circuit_free_(TO_CIRCUIT(c4));
if (c5)
- circuit_free(TO_CIRCUIT(c5));
+ circuit_free_(TO_CIRCUIT(c5));
}
static void
@@ -452,10 +452,10 @@ test_hs_circuitmap_isolation(void *arg)
}
done:
- circuit_free(TO_CIRCUIT(circ1));
- circuit_free(TO_CIRCUIT(circ2));
- circuit_free(TO_CIRCUIT(circ3));
- circuit_free(TO_CIRCUIT(circ4));
+ circuit_free_(TO_CIRCUIT(circ1));
+ circuit_free_(TO_CIRCUIT(circ2));
+ circuit_free_(TO_CIRCUIT(circ3));
+ circuit_free_(TO_CIRCUIT(circ4));
}
struct testcase_t circuitlist_tests[] = {
diff --git a/src/test/test_dir.c b/src/test/test_dir.c
index 83734ccfd9..ee7aea5b84 100644
--- a/src/test/test_dir.c
+++ b/src/test/test_dir.c
@@ -567,7 +567,7 @@ test_dir_routerinfo_parsing(void *arg)
static void
routerinfo_free_wrapper_(void *arg)
{
- routerinfo_free(arg);
+ routerinfo_free_(arg);
}
static void
@@ -664,7 +664,7 @@ test_dir_extrainfo_parsing(void *arg)
escaped(NULL);
extrainfo_free(ei);
routerinfo_free(ri);
- digestmap_free((digestmap_t*)map, routerinfo_free_wrapper_);
+ digestmap_free_((digestmap_t*)map, routerinfo_free_wrapper_);
}
static void
@@ -760,7 +760,7 @@ test_dir_parse_router_list(void *arg)
smartlist_free(chunks);
routerinfo_free(ri);
if (map) {
- digestmap_free((digestmap_t*)map, routerinfo_free_wrapper_);
+ digestmap_free_((digestmap_t*)map, routerinfo_free_wrapper_);
router_get_routerlist()->identity_map =
(struct digest_ri_map_t*)digestmap_new();
}
diff --git a/src/test/test_dir_handle_get.c b/src/test/test_dir_handle_get.c
index 28ecc14c49..ca64dce5fe 100644
--- a/src/test/test_dir_handle_get.c
+++ b/src/test/test_dir_handle_get.c
@@ -88,7 +88,7 @@ test_dir_handle_get_bad_request(void *data)
done:
UNMOCK(connection_write_to_buf_impl_);
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
tor_free(header);
}
@@ -117,7 +117,7 @@ test_dir_handle_get_v1_command_not_found(void *data)
done:
UNMOCK(connection_write_to_buf_impl_);
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
tor_free(header);
}
@@ -164,7 +164,7 @@ test_dir_handle_get_v1_command(void *data)
done:
UNMOCK(connection_write_to_buf_impl_);
UNMOCK(get_dirportfrontpage);
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
tor_free(header);
tor_free(body);
}
@@ -190,7 +190,7 @@ test_dir_handle_get_not_found(void *data)
done:
UNMOCK(connection_write_to_buf_impl_);
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
tor_free(header);
}
@@ -225,7 +225,7 @@ test_dir_handle_get_robots_txt(void *data)
done:
UNMOCK(connection_write_to_buf_impl_);
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
tor_free(header);
tor_free(body);
}
@@ -254,7 +254,7 @@ test_dir_handle_get_rendezvous2_not_found_if_not_encrypted(void *data)
done:
UNMOCK(connection_write_to_buf_impl_);
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
tor_free(header);
}
@@ -282,7 +282,7 @@ test_dir_handle_get_rendezvous2_on_encrypted_conn_with_invalid_desc_id(
done:
UNMOCK(connection_write_to_buf_impl_);
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
tor_free(header);
}
@@ -315,7 +315,7 @@ test_dir_handle_get_rendezvous2_on_encrypted_conn_not_well_formed(void *data)
done:
UNMOCK(connection_write_to_buf_impl_);
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
tor_free(header);
}
@@ -344,7 +344,7 @@ test_dir_handle_get_rendezvous2_not_found(void *data)
done:
UNMOCK(connection_write_to_buf_impl_);
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
tor_free(header);
rend_cache_free_all();
}
@@ -424,7 +424,7 @@ test_dir_handle_get_rendezvous2_on_encrypted_conn_success(void *data)
UNMOCK(connection_write_to_buf_impl_);
NS_UNMOCK(router_get_my_routerinfo);
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
tor_free(header);
tor_free(body);
rend_encoded_v2_service_descriptor_free(desc_holder);
@@ -457,7 +457,7 @@ test_dir_handle_get_micro_d_not_found(void *data)
done:
UNMOCK(connection_write_to_buf_impl_);
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
tor_free(header);
}
@@ -542,7 +542,7 @@ test_dir_handle_get_micro_d(void *data)
UNMOCK(connection_write_to_buf_impl_);
or_options_free(mock_options); mock_options = NULL;
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
tor_free(header);
tor_free(body);
smartlist_free(list);
@@ -596,7 +596,7 @@ test_dir_handle_get_micro_d_server_busy(void *data)
UNMOCK(connection_write_to_buf_impl_);
or_options_free(mock_options); mock_options = NULL;
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
tor_free(header);
smartlist_free(list);
microdesc_free_all();
@@ -633,7 +633,7 @@ test_dir_handle_get_networkstatus_bridges_not_found_without_auth(void *data)
UNMOCK(get_options);
UNMOCK(connection_write_to_buf_impl_);
or_options_free(mock_options); mock_options = NULL;
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
tor_free(header);
}
@@ -673,7 +673,7 @@ test_dir_handle_get_networkstatus_bridges(void *data)
UNMOCK(get_options);
UNMOCK(connection_write_to_buf_impl_);
or_options_free(mock_options); mock_options = NULL;
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
tor_free(header);
}
@@ -710,7 +710,7 @@ test_dir_handle_get_networkstatus_bridges_not_found_wrong_auth(void *data)
UNMOCK(get_options);
UNMOCK(connection_write_to_buf_impl_);
or_options_free(mock_options); mock_options = NULL;
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
tor_free(header);
}
@@ -738,7 +738,7 @@ test_dir_handle_get_server_descriptors_not_found(void* data)
done:
UNMOCK(connection_write_to_buf_impl_);
or_options_free(mock_options); mock_options = NULL;
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
tor_free(header);
}
@@ -799,7 +799,7 @@ test_dir_handle_get_server_descriptors_all(void* data)
done:
NS_UNMOCK(router_get_my_routerinfo);
UNMOCK(connection_write_to_buf_impl_);
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
tor_free(header);
tor_free(body);
@@ -903,7 +903,7 @@ test_dir_handle_get_server_descriptors_authority(void* data)
UNMOCK(connection_write_to_buf_impl_);
tor_free(mock_routerinfo->cache_info.signed_descriptor_body);
tor_free(mock_routerinfo);
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
tor_free(header);
tor_free(body);
crypto_pk_free(identity_pkey);
@@ -975,7 +975,7 @@ test_dir_handle_get_server_descriptors_fp(void* data)
UNMOCK(connection_write_to_buf_impl_);
tor_free(mock_routerinfo->cache_info.signed_descriptor_body);
tor_free(mock_routerinfo);
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
tor_free(header);
tor_free(body);
crypto_pk_free(identity_pkey);
@@ -1039,7 +1039,7 @@ test_dir_handle_get_server_descriptors_d(void* data)
done:
UNMOCK(connection_write_to_buf_impl_);
tor_free(mock_routerinfo);
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
tor_free(header);
tor_free(body);
crypto_pk_free(identity_pkey);
@@ -1095,7 +1095,7 @@ test_dir_handle_get_server_descriptors_busy(void* data)
UNMOCK(get_options);
UNMOCK(connection_write_to_buf_impl_);
tor_free(mock_routerinfo);
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
tor_free(header);
crypto_pk_free(identity_pkey);
@@ -1126,7 +1126,7 @@ test_dir_handle_get_server_keys_bad_req(void* data)
done:
UNMOCK(connection_write_to_buf_impl_);
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
tor_free(header);
}
@@ -1152,7 +1152,7 @@ test_dir_handle_get_server_keys_all_not_found(void* data)
done:
UNMOCK(connection_write_to_buf_impl_);
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
tor_free(header);
}
@@ -1211,7 +1211,7 @@ test_dir_handle_get_server_keys_all(void* data)
done:
UNMOCK(connection_write_to_buf_impl_);
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
tor_free(header);
tor_free(body);
@@ -1241,7 +1241,7 @@ test_dir_handle_get_server_keys_authority_not_found(void* data)
done:
UNMOCK(connection_write_to_buf_impl_);
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
tor_free(header);
}
@@ -1289,7 +1289,7 @@ test_dir_handle_get_server_keys_authority(void* data)
done:
UNMOCK(get_my_v3_authority_cert);
UNMOCK(connection_write_to_buf_impl_);
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
tor_free(header);
tor_free(body);
authority_cert_free(mock_cert); mock_cert = NULL;
@@ -1317,7 +1317,7 @@ test_dir_handle_get_server_keys_fp_not_found(void* data)
done:
UNMOCK(connection_write_to_buf_impl_);
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
tor_free(header);
}
@@ -1371,7 +1371,7 @@ test_dir_handle_get_server_keys_fp(void* data)
done:
UNMOCK(connection_write_to_buf_impl_);
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
tor_free(header);
tor_free(body);
clear_dir_servers();
@@ -1400,7 +1400,7 @@ test_dir_handle_get_server_keys_sk_not_found(void* data)
done:
UNMOCK(connection_write_to_buf_impl_);
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
tor_free(header);
}
@@ -1445,7 +1445,7 @@ test_dir_handle_get_server_keys_sk(void* data)
done:
UNMOCK(get_my_v3_authority_cert);
UNMOCK(connection_write_to_buf_impl_);
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
authority_cert_free(mock_cert); mock_cert = NULL;
tor_free(header);
tor_free(body);
@@ -1473,7 +1473,7 @@ test_dir_handle_get_server_keys_fpsk_not_found(void* data)
done:
UNMOCK(connection_write_to_buf_impl_);
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
tor_free(header);
}
@@ -1530,7 +1530,7 @@ test_dir_handle_get_server_keys_fpsk(void* data)
done:
UNMOCK(connection_write_to_buf_impl_);
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
tor_free(header);
tor_free(body);
@@ -1584,7 +1584,7 @@ test_dir_handle_get_server_keys_busy(void* data)
done:
UNMOCK(get_options);
UNMOCK(connection_write_to_buf_impl_);
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
tor_free(header);
or_options_free(mock_options); mock_options = NULL;
@@ -1650,7 +1650,7 @@ test_dir_handle_get_status_vote_current_consensus_ns_not_enough_sigs(void* d)
UNMOCK(connection_write_to_buf_impl_);
UNMOCK(get_options);
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
tor_free(header);
tor_free(stats);
smartlist_free(mock_ns_val->voters);
@@ -1691,7 +1691,7 @@ test_dir_handle_get_status_vote_current_consensus_ns_not_found(void* data)
done:
UNMOCK(connection_write_to_buf_impl_);
UNMOCK(get_options);
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
tor_free(header);
tor_free(stats);
or_options_free(mock_options); mock_options = NULL;
@@ -1765,7 +1765,7 @@ test_dir_handle_get_status_vote_current_consensus_too_old(void *data)
UNMOCK(networkstatus_get_latest_consensus_by_flavor);
UNMOCK(connection_write_to_buf_impl_);
UNMOCK(get_options);
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
tor_free(header);
tor_free(mock_ns_val);
or_options_free(mock_options); mock_options = NULL;
@@ -1826,7 +1826,7 @@ status_vote_current_consensus_ns_test(char **header, char **body,
done:
UNMOCK(connection_write_to_buf_impl_);
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
}
static void
@@ -1949,7 +1949,7 @@ test_dir_handle_get_status_vote_current_not_found(void* data)
done:
UNMOCK(connection_write_to_buf_impl_);
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
tor_free(header);
}
@@ -1972,7 +1972,7 @@ status_vote_current_d_test(char **header, char **body, size_t *body_l)
done:
UNMOCK(connection_write_to_buf_impl_);
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
}
static void
@@ -1992,7 +1992,7 @@ status_vote_next_d_test(char **header, char **body, size_t *body_l)
done:
UNMOCK(connection_write_to_buf_impl_);
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
}
static void
@@ -2117,7 +2117,7 @@ test_dir_handle_get_status_vote_next_not_found(void* data)
done:
UNMOCK(connection_write_to_buf_impl_);
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
tor_free(header);
}
@@ -2136,7 +2136,7 @@ status_vote_next_consensus_test(char **header, char **body, size_t *body_used)
body, body_used, 18, 0);
done:
UNMOCK(connection_write_to_buf_impl_);
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
}
static void
@@ -2176,7 +2176,7 @@ test_dir_handle_get_status_vote_current_authority_not_found(void* data)
done:
UNMOCK(connection_write_to_buf_impl_);
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
tor_free(header);
}
@@ -2200,7 +2200,7 @@ test_dir_handle_get_status_vote_next_authority_not_found(void* data)
done:
UNMOCK(connection_write_to_buf_impl_);
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
tor_free(header);
}
@@ -2282,7 +2282,7 @@ status_vote_next_consensus_signatures_test(char **header, char **body,
body, body_used, 22, 0);
done:
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
UNMOCK(connection_write_to_buf_impl_);
}
@@ -2430,7 +2430,7 @@ test_dir_handle_get_status_vote_next_authority(void* data)
done:
UNMOCK(connection_write_to_buf_impl_);
UNMOCK(get_my_v3_authority_cert);
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
tor_free(header);
tor_free(body);
authority_cert_free(mock_cert); mock_cert = NULL;
@@ -2512,7 +2512,7 @@ test_dir_handle_get_status_vote_current_authority(void* data)
done:
UNMOCK(connection_write_to_buf_impl_);
UNMOCK(get_my_v3_authority_cert);
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
tor_free(header);
tor_free(body);
authority_cert_free(mock_cert); mock_cert = NULL;
diff --git a/src/test/test_dns.c b/src/test/test_dns.c
index 66b231b6da..1fee01d2c0 100644
--- a/src/test/test_dns.c
+++ b/src/test/test_dns.c
@@ -124,7 +124,7 @@ static int n_connection_free = 0;
static connection_t *last_freed_conn = NULL;
static void
-NS(connection_free)(connection_t *conn)
+NS(connection_free_)(connection_t *conn)
{
n_connection_free++;
@@ -267,7 +267,7 @@ NS(test_main)(void *arg)
*/
NS_MOCK(dns_cancel_pending_resolve);
- NS_MOCK(connection_free);
+ NS_MOCK(connection_free_);
exitconn->on_circuit = &(on_circuit->base_);
exitconn->base_.purpose = EXIT_PURPOSE_RESOLVE;
@@ -294,7 +294,7 @@ NS(test_main)(void *arg)
NS_UNMOCK(send_resolved_cell);
NS_UNMOCK(send_resolved_hostname_cell);
NS_UNMOCK(dns_cancel_pending_resolve);
- NS_UNMOCK(connection_free);
+ NS_UNMOCK(connection_free_);
tor_free(on_circuit);
tor_free(exitconn);
tor_free(nextconn);
diff --git a/src/test/test_entryconn.c b/src/test/test_entryconn.c
index c29b1a7126..9d8a072c77 100644
--- a/src/test/test_entryconn.c
+++ b/src/test/test_entryconn.c
@@ -34,7 +34,7 @@ entryconn_rewrite_teardown(const struct testcase_t *tc, void *arg)
(void)tc;
entry_connection_t *ec = arg;
if (ec)
- connection_free_(ENTRY_TO_CONN(ec));
+ connection_free_minimal(ENTRY_TO_CONN(ec));
addressmap_free_all();
return 1;
}
@@ -156,8 +156,8 @@ test_entryconn_rewrite_automap_ipv4(void *arg)
ec->socks_request->address);
done:
- connection_free_(ENTRY_TO_CONN(ec2));
- connection_free_(ENTRY_TO_CONN(ec3));
+ connection_free_minimal(ENTRY_TO_CONN(ec2));
+ connection_free_minimal(ENTRY_TO_CONN(ec3));
}
/* Automap on resolve, connect to automapped address, resolve again and get
@@ -230,9 +230,9 @@ test_entryconn_rewrite_automap_ipv6(void *arg)
ec->socks_request->address);
done:
- connection_free_(ENTRY_TO_CONN(ec));
- connection_free_(ENTRY_TO_CONN(ec2));
- connection_free_(ENTRY_TO_CONN(ec3));
+ connection_free_minimal(ENTRY_TO_CONN(ec));
+ connection_free_minimal(ENTRY_TO_CONN(ec2));
+ connection_free_minimal(ENTRY_TO_CONN(ec3));
}
#if 0
@@ -283,7 +283,7 @@ test_entryconn_rewrite_automap_reverse(void *arg)
tt_int_op(rr.exit_source, OP_EQ, ADDRMAPSRC_NONE);
done:
- connection_free_(ENTRY_TO_CONN(ec2));
+ connection_free_minimal(ENTRY_TO_CONN(ec2));
}
#endif /* 0 */
@@ -333,7 +333,7 @@ test_entryconn_rewrite_cached_dns_ipv4(void *arg)
tt_str_op(ec2->socks_request->address, OP_EQ, "240.240.241.241");
done:
- connection_free_(ENTRY_TO_CONN(ec2));
+ connection_free_minimal(ENTRY_TO_CONN(ec2));
}
/* Rewrite because of cached DNS entry. */
@@ -385,8 +385,8 @@ test_entryconn_rewrite_cached_dns_ipv6(void *arg)
tt_str_op(ec2->socks_request->address, OP_EQ, "[::f00f]");
done:
- connection_free_(ENTRY_TO_CONN(ec));
- connection_free_(ENTRY_TO_CONN(ec2));
+ connection_free_minimal(ENTRY_TO_CONN(ec));
+ connection_free_minimal(ENTRY_TO_CONN(ec2));
}
/* Fail to connect to unmapped address in virtual range. */
@@ -426,7 +426,7 @@ test_entryconn_rewrite_unmapped_virtual(void *arg)
tt_int_op(rr.exit_source, OP_EQ, ADDRMAPSRC_NONE);
done:
- connection_free_(ENTRY_TO_CONN(ec2));
+ connection_free_minimal(ENTRY_TO_CONN(ec2));
}
/* Rewrite because of mapaddress option */
@@ -507,7 +507,7 @@ test_entryconn_rewrite_automap_exit(void *arg)
tt_int_op(rr.end_reason, OP_EQ, END_STREAM_REASON_TORPROTOCOL);
done:
- connection_free_(ENTRY_TO_CONN(ec2));
+ connection_free_minimal(ENTRY_TO_CONN(ec2));
}
/* Rewrite into .exit because of mapaddress */
@@ -618,9 +618,9 @@ test_entryconn_rewrite_mapaddress_automap_onion(void *arg)
*/
done:
- connection_free_(ENTRY_TO_CONN(ec2));
- connection_free_(ENTRY_TO_CONN(ec3));
- connection_free_(ENTRY_TO_CONN(ec4));
+ connection_free_minimal(ENTRY_TO_CONN(ec2));
+ connection_free_minimal(ENTRY_TO_CONN(ec3));
+ connection_free_minimal(ENTRY_TO_CONN(ec4));
}
static void
@@ -678,8 +678,8 @@ test_entryconn_rewrite_mapaddress_automap_onion_common(entry_connection_t *ec,
"abcdefghijklmnop.onion"));
done:
- connection_free_(ENTRY_TO_CONN(ec2));
- connection_free_(ENTRY_TO_CONN(ec3));
+ connection_free_minimal(ENTRY_TO_CONN(ec2));
+ connection_free_minimal(ENTRY_TO_CONN(ec3));
}
/* This time is the same, but we start with a mapping from a non-onion
diff --git a/src/test/test_entrynodes.c b/src/test/test_entrynodes.c
index 80ebebe3f8..1cff3828c4 100644
--- a/src/test/test_entrynodes.c
+++ b/src/test/test_entrynodes.c
@@ -2372,8 +2372,8 @@ upgrade_circuits_cleanup(const struct testcase_t *testcase, void *ptr)
// circuit_guard_state_free(data->guard2_state); // held in circ2
guard_selection_free(data->gs);
smartlist_free(data->all_origin_circuits);
- circuit_free(TO_CIRCUIT(data->circ1));
- circuit_free(TO_CIRCUIT(data->circ2));
+ circuit_free_(TO_CIRCUIT(data->circ1));
+ circuit_free_(TO_CIRCUIT(data->circ2));
tor_free(data);
return big_fake_network_cleanup(testcase, NULL);
}
diff --git a/src/test/test_extorport.c b/src/test/test_extorport.c
index e18deb2700..cadef257f1 100644
--- a/src/test/test_extorport.c
+++ b/src/test/test_extorport.c
@@ -58,11 +58,11 @@ test_ext_or_id_map(void *arg)
done:
if (c1)
- connection_free_(TO_CONN(c1));
+ connection_free_minimal(TO_CONN(c1));
if (c2)
- connection_free_(TO_CONN(c2));
+ connection_free_minimal(TO_CONN(c2));
if (c3)
- connection_free_(TO_CONN(c3));
+ connection_free_minimal(TO_CONN(c3));
tor_free(idp);
tor_free(idp2);
connection_or_clear_ext_or_id_map();
@@ -145,7 +145,7 @@ test_ext_or_write_command(void *arg)
done:
if (c1)
- connection_free_(TO_CONN(c1));
+ connection_free_minimal(TO_CONN(c1));
tor_free(cp);
tor_free(buf);
UNMOCK(connection_write_to_buf_impl_);
@@ -591,7 +591,7 @@ test_ext_or_handshake(void *arg)
UNMOCK(connection_write_to_buf_impl_);
UNMOCK(crypto_rand);
if (conn)
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
#undef CONTAINS
#undef WRITE
}
diff --git a/src/test/test_handles.c b/src/test/test_handles.c
index 7ddee6e376..eb1e1f1bbe 100644
--- a/src/test/test_handles.c
+++ b/src/test/test_handles.c
@@ -13,6 +13,8 @@ typedef struct demo_t {
} demo_t;
HANDLE_DECL(demo, demo_t, static)
+#define demo_handle_free(h) \
+ FREE_AND_NULL(demo_handle_t, demo_handle_free_, (h))
HANDLE_IMPL(demo, demo_t, static)
static demo_t *
diff --git a/src/test/test_hs_cache.c b/src/test/test_hs_cache.c
index 91b13be862..458ce1a92e 100644
--- a/src/test/test_hs_cache.c
+++ b/src/test/test_hs_cache.c
@@ -259,7 +259,7 @@ helper_fetch_desc_from_hsdir(const ed25519_public_key_t *blinded_key)
done:
tor_free(hsdir_query_str);
if (conn)
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
return received_desc;
}
diff --git a/src/test/test_hs_client.c b/src/test/test_hs_client.c
index 750920fac0..7ee7210bc9 100644
--- a/src/test/test_hs_client.c
+++ b/src/test/test_hs_client.c
@@ -227,10 +227,10 @@ test_e2e_rend_circuit_setup_legacy(void *arg)
tt_ptr_op(TO_EDGE_CONN(conn)->on_circuit, OP_EQ, TO_CIRCUIT(or_circ));
done:
- connection_free_(conn);
+ connection_free_minimal(conn);
if (or_circ)
tor_free(TO_CIRCUIT(or_circ)->n_chan);
- circuit_free(TO_CIRCUIT(or_circ));
+ circuit_free_(TO_CIRCUIT(or_circ));
}
/* Test: Ensure that setting up v3 rendezvous circuits works correctly. */
@@ -297,10 +297,10 @@ test_e2e_rend_circuit_setup(void *arg)
tt_ptr_op(TO_EDGE_CONN(conn)->on_circuit, OP_EQ, TO_CIRCUIT(or_circ));
done:
- connection_free_(conn);
+ connection_free_minimal(conn);
if (or_circ)
tor_free(TO_CIRCUIT(or_circ)->n_chan);
- circuit_free(TO_CIRCUIT(or_circ));
+ circuit_free_(TO_CIRCUIT(or_circ));
}
/** Test client logic for picking intro points from a descriptor. Also test how
@@ -560,7 +560,7 @@ test_descriptor_fetch(void *arg)
smartlist_add(get_connection_array(), TO_CONN(dir_conn));
ret = hs_client_refetch_hsdesc(&service_pk);
smartlist_remove(get_connection_array(), TO_CONN(dir_conn));
- connection_free_(TO_CONN(dir_conn));
+ connection_free_minimal(TO_CONN(dir_conn));
tt_int_op(ret, OP_EQ, HS_CLIENT_FETCH_PENDING);
}
@@ -579,7 +579,7 @@ test_descriptor_fetch(void *arg)
tt_int_op(ec->edge_.end_reason, OP_EQ, END_STREAM_REASON_RESOLVEFAILED);
done:
- connection_free_(ENTRY_TO_CONN(ec));
+ connection_free_minimal(ENTRY_TO_CONN(ec));
UNMOCK(networkstatus_get_live_consensus);
UNMOCK(router_have_minimum_dir_info);
hs_free_all();
diff --git a/src/test/test_hs_intropoint.c b/src/test/test_hs_intropoint.c
index 0cae2de7e1..6a7962b212 100644
--- a/src/test/test_hs_intropoint.c
+++ b/src/test/test_hs_intropoint.c
@@ -194,7 +194,7 @@ test_establish_intro_wrong_purpose(void *arg)
tt_int_op(retval, OP_EQ, -1);
done:
- circuit_free(TO_CIRCUIT(intro_circ));
+ circuit_free_(TO_CIRCUIT(intro_circ));
}
/* Prepare a circuit for accepting an ESTABLISH_INTRO cell */
@@ -228,7 +228,7 @@ test_establish_intro_wrong_keytype(void *arg)
tt_int_op(retval, OP_EQ, -1);
done:
- circuit_free(TO_CIRCUIT(intro_circ));
+ circuit_free_(TO_CIRCUIT(intro_circ));
}
/* Send an ESTABLISH_INTRO cell with an unknown auth key type. Should fail. */
@@ -263,7 +263,7 @@ test_establish_intro_wrong_keytype2(void *arg)
tt_int_op(retval, OP_EQ, -1);
done:
- circuit_free(TO_CIRCUIT(intro_circ));
+ circuit_free_(TO_CIRCUIT(intro_circ));
}
/* Send a legit ESTABLISH_INTRO cell but with a wrong MAC. Should fail. */
@@ -333,7 +333,7 @@ test_establish_intro_wrong_mac(void *arg)
done:
trn_cell_establish_intro_free(cell);
- circuit_free(TO_CIRCUIT(intro_circ));
+ circuit_free_(TO_CIRCUIT(intro_circ));
}
/* Send a legit ESTABLISH_INTRO cell but with a wrong auth key length. Should
@@ -378,7 +378,7 @@ test_establish_intro_wrong_auth_key_len(void *arg)
done:
trn_cell_establish_intro_free(cell);
- circuit_free(TO_CIRCUIT(intro_circ));
+ circuit_free_(TO_CIRCUIT(intro_circ));
}
/* Send a legit ESTABLISH_INTRO cell but with a wrong sig length. Should
@@ -423,7 +423,7 @@ test_establish_intro_wrong_sig_len(void *arg)
done:
trn_cell_establish_intro_free(cell);
- circuit_free(TO_CIRCUIT(intro_circ));
+ circuit_free_(TO_CIRCUIT(intro_circ));
}
/* Send a legit ESTABLISH_INTRO cell but slightly change the signature. Should
@@ -460,7 +460,7 @@ test_establish_intro_wrong_sig(void *arg)
tt_int_op(retval, OP_EQ, -1);
done:
- circuit_free(TO_CIRCUIT(intro_circ));
+ circuit_free_(TO_CIRCUIT(intro_circ));
}
/* Helper function: Send a well-formed v3 ESTABLISH_INTRO cell to
@@ -629,8 +629,8 @@ test_intro_point_registration(void *arg)
done:
crypto_pk_free(legacy_auth_key);
- circuit_free(TO_CIRCUIT(intro_circ));
- circuit_free(TO_CIRCUIT(legacy_intro_circ));
+ circuit_free_(TO_CIRCUIT(intro_circ));
+ circuit_free_(TO_CIRCUIT(legacy_intro_circ));
trn_cell_establish_intro_free(establish_intro_cell);
test_circuitmap_free_all();
@@ -650,7 +650,7 @@ test_introduce1_suitable_circuit(void *arg)
circ = or_circuit_new(0, NULL);
circuit_change_purpose(TO_CIRCUIT(circ), CIRCUIT_PURPOSE_OR);
ret = circuit_is_suitable_for_introduce1(circ);
- circuit_free(TO_CIRCUIT(circ));
+ circuit_free_(TO_CIRCUIT(circ));
tt_int_op(ret, OP_EQ, 1);
}
@@ -659,7 +659,7 @@ test_introduce1_suitable_circuit(void *arg)
circ = or_circuit_new(0, NULL);
circuit_change_purpose(TO_CIRCUIT(circ), CIRCUIT_PURPOSE_INTRO_POINT);
ret = circuit_is_suitable_for_introduce1(circ);
- circuit_free(TO_CIRCUIT(circ));
+ circuit_free_(TO_CIRCUIT(circ));
tt_int_op(ret, OP_EQ, 0);
}
@@ -670,7 +670,7 @@ test_introduce1_suitable_circuit(void *arg)
/* Bogus pointer, the check is against NULL on n_chan. */
circ->base_.n_chan = (channel_t *) circ;
ret = circuit_is_suitable_for_introduce1(circ);
- circuit_free(TO_CIRCUIT(circ));
+ circuit_free_(TO_CIRCUIT(circ));
tt_int_op(ret, OP_EQ, 0);
}
@@ -681,7 +681,7 @@ test_introduce1_suitable_circuit(void *arg)
circuit_change_purpose(TO_CIRCUIT(circ), CIRCUIT_PURPOSE_OR);
circ->already_received_introduce1 = 1;
ret = circuit_is_suitable_for_introduce1(circ);
- circuit_free(TO_CIRCUIT(circ));
+ circuit_free_(TO_CIRCUIT(circ));
tt_int_op(ret, OP_EQ, 0);
}
@@ -800,7 +800,7 @@ test_received_introduce1_handling(void *arg)
circ = helper_create_intro_circuit();
ret = hs_intro_received_introduce1(circ, buf, DIGEST_LEN - 1);
tt_int_op(ret, OP_EQ, -1);
- circuit_free(TO_CIRCUIT(circ));
+ circuit_free_(TO_CIRCUIT(circ));
}
/* We have a unit test only for the suitability of a circuit to receive an
@@ -813,7 +813,7 @@ test_received_introduce1_handling(void *arg)
memset(test, 0, sizeof(test));
ret = handle_introduce1(circ, test, sizeof(test));
tor_free(circ->p_chan);
- circuit_free(TO_CIRCUIT(circ));
+ circuit_free_(TO_CIRCUIT(circ));
tt_int_op(ret, OP_EQ, -1);
}
@@ -838,8 +838,8 @@ test_received_introduce1_handling(void *arg)
memcpy(auth_key.pubkey, cell_auth_key, ED25519_PUBKEY_LEN);
hs_circuitmap_register_intro_circ_v3_relay_side(service_circ, &auth_key);
ret = hs_intro_received_introduce1(circ, request, request_len);
- circuit_free(TO_CIRCUIT(circ));
- circuit_free(TO_CIRCUIT(service_circ));
+ circuit_free_(TO_CIRCUIT(circ));
+ circuit_free_(TO_CIRCUIT(service_circ));
tt_int_op(ret, OP_EQ, 0);
}
@@ -867,8 +867,8 @@ test_received_introduce1_handling(void *arg)
memcpy(token, legacy_key_id, sizeof(token));
hs_circuitmap_register_intro_circ_v2_relay_side(service_circ, token);
ret = hs_intro_received_introduce1(circ, request, request_len);
- circuit_free(TO_CIRCUIT(circ));
- circuit_free(TO_CIRCUIT(service_circ));
+ circuit_free_(TO_CIRCUIT(circ));
+ circuit_free_(TO_CIRCUIT(service_circ));
tt_int_op(ret, OP_EQ, 0);
}
diff --git a/src/test/test_hs_service.c b/src/test/test_hs_service.c
index 3084c6b958..99aa4ae7b4 100644
--- a/src/test/test_hs_service.c
+++ b/src/test/test_hs_service.c
@@ -182,7 +182,7 @@ test_e2e_rend_circuit_setup(void *arg)
tt_int_op(or_circ->base_.purpose, OP_EQ, CIRCUIT_PURPOSE_S_REND_JOINED);
done:
- circuit_free(TO_CIRCUIT(or_circ));
+ circuit_free_(TO_CIRCUIT(or_circ));
}
/* Helper: Return a newly allocated and initialized origin circuit with
@@ -655,7 +655,7 @@ test_intro_circuit_opened(void *arg)
teardown_capture_of_logs();
done:
- circuit_free(TO_CIRCUIT(circ));
+ circuit_free_(TO_CIRCUIT(circ));
hs_free_all();
UNMOCK(circuit_mark_for_close_);
UNMOCK(relay_send_command_from_edge_);
@@ -730,7 +730,7 @@ test_intro_established(void *arg)
done:
if (circ)
- circuit_free(TO_CIRCUIT(circ));
+ circuit_free_(TO_CIRCUIT(circ));
hs_free_all();
UNMOCK(circuit_mark_for_close_);
}
@@ -772,7 +772,7 @@ test_rdv_circuit_opened(void *arg)
tt_int_op(TO_CIRCUIT(circ)->purpose, OP_EQ, CIRCUIT_PURPOSE_S_REND_JOINED);
done:
- circuit_free(TO_CIRCUIT(circ));
+ circuit_free_(TO_CIRCUIT(circ));
hs_free_all();
UNMOCK(circuit_mark_for_close_);
UNMOCK(relay_send_command_from_edge_);
@@ -852,7 +852,7 @@ test_introduce2(void *arg)
or_state_free(dummy_state);
dummy_state = NULL;
if (circ)
- circuit_free(TO_CIRCUIT(circ));
+ circuit_free_(TO_CIRCUIT(circ));
hs_free_all();
UNMOCK(circuit_mark_for_close_);
}
@@ -936,7 +936,7 @@ test_service_event(void *arg)
done:
hs_circuitmap_remove_circuit(TO_CIRCUIT(circ));
- circuit_free(TO_CIRCUIT(circ));
+ circuit_free_(TO_CIRCUIT(circ));
hs_free_all();
UNMOCK(circuit_mark_for_close_);
}
@@ -1490,8 +1490,8 @@ test_rendezvous1_parsing(void *arg)
* would need an extra circuit and some more stuff but it's doable. */
done:
- circuit_free(TO_CIRCUIT(service_circ));
- circuit_free(TO_CIRCUIT(client_circ));
+ circuit_free_(TO_CIRCUIT(service_circ));
+ circuit_free_(TO_CIRCUIT(client_circ));
hs_service_free(service);
hs_free_all();
UNMOCK(relay_send_command_from_edge_);
diff --git a/src/test/test_link_handshake.c b/src/test/test_link_handshake.c
index 422d419078..6840072d76 100644
--- a/src/test/test_link_handshake.c
+++ b/src/test/test_link_handshake.c
@@ -302,8 +302,8 @@ test_link_handshake_certs_ok(void *arg)
mock_own_cert = mock_peer_cert = NULL;
memset(c1->identity_digest, 0, sizeof(c1->identity_digest));
memset(c2->identity_digest, 0, sizeof(c2->identity_digest));
- connection_free_(TO_CONN(c1));
- connection_free_(TO_CONN(c2));
+ connection_free_minimal(TO_CONN(c1));
+ connection_free_minimal(TO_CONN(c2));
tor_free(cell1);
tor_free(cell2);
certs_cell_free(cc1);
@@ -343,7 +343,7 @@ recv_certs_cleanup(const struct testcase_t *test, void *obj)
tor_free(d->cell);
certs_cell_free(d->ccell);
connection_or_clear_identity(d->c);
- connection_free_(TO_CONN(d->c));
+ connection_free_minimal(TO_CONN(d->c));
circuitmux_free(d->chan->base_.cmux);
tor_free(d->chan);
crypto_pk_free(d->key1);
@@ -930,7 +930,7 @@ test_link_handshake_send_authchallenge(void *arg)
done:
UNMOCK(connection_or_write_var_cell_to_buf);
- connection_free_(TO_CONN(c1));
+ connection_free_minimal(TO_CONN(c1));
tor_free(cell1);
tor_free(cell2);
crypto_pk_free(rsa0);
@@ -955,7 +955,7 @@ recv_authchallenge_cleanup(const struct testcase_t *test, void *obj)
if (d) {
tor_free(d->cell);
- connection_free_(TO_CONN(d->c));
+ connection_free_minimal(TO_CONN(d->c));
circuitmux_free(d->chan->base_.cmux);
tor_free(d->chan);
tor_free(d);
@@ -1158,8 +1158,8 @@ authenticate_data_cleanup(const struct testcase_t *test, void *arg)
tor_free(d->cell);
connection_or_clear_identity(d->c1);
connection_or_clear_identity(d->c2);
- connection_free_(TO_CONN(d->c1));
- connection_free_(TO_CONN(d->c2));
+ connection_free_minimal(TO_CONN(d->c1));
+ connection_free_minimal(TO_CONN(d->c2));
circuitmux_free(d->chan2->base_.cmux);
tor_free(d->chan2);
crypto_pk_free(d->key1);
diff --git a/src/test/test_oom.c b/src/test/test_oom.c
index 973501c3d7..c172fe60c7 100644
--- a/src/test/test_oom.c
+++ b/src/test/test_oom.c
@@ -341,7 +341,7 @@ test_oom_streambuf(void *arg)
circuit_free(c5);
SMARTLIST_FOREACH(edgeconns, edge_connection_t *, ec,
- connection_free_(TO_CONN(ec)));
+ connection_free_minimal(TO_CONN(ec)));
smartlist_free(edgeconns);
UNMOCK(circuit_mark_for_close_);
diff --git a/src/test/test_policy.c b/src/test/test_policy.c
index 83dca2d431..f8aa8ac40b 100644
--- a/src/test/test_policy.c
+++ b/src/test/test_policy.c
@@ -1318,7 +1318,7 @@ mock_get_interface_address6_list(int severity,
return clone_list;
done:
- free_interface_address6_list(clone_list);
+ interface_address6_list_free(clone_list);
return NULL;
}
@@ -1393,11 +1393,11 @@ test_policies_reject_interface_address(void *arg)
done:
addr_policy_list_free(policy);
- free_interface_address6_list(public_ipv4_addrs);
- free_interface_address6_list(public_ipv6_addrs);
+ interface_address6_list_free(public_ipv4_addrs);
+ interface_address6_list_free(public_ipv6_addrs);
UNMOCK(get_interface_address6_list);
- /* we don't use free_interface_address6_list on these lists because their
+ /* we don't use interface_address6_list_free on these lists because their
* address pointers are stack-based */
smartlist_free(mock_ipv4_addrs);
smartlist_free(mock_ipv6_addrs);
diff --git a/src/test/test_rendcache.c b/src/test/test_rendcache.c
index 9354dd0480..9f6cfc4a22 100644
--- a/src/test/test_rendcache.c
+++ b/src/test/test_rendcache.c
@@ -834,7 +834,7 @@ test_rend_cache_failure_entry_free(void *data)
(void)data;
// Test that it can deal with a NULL argument
- rend_cache_failure_entry_free(NULL);
+ rend_cache_failure_entry_free_(NULL);
/* done: */
/* (void)0; */
@@ -963,7 +963,7 @@ test_rend_cache_entry_free(void *data)
rend_cache_entry_t *e;
// Handles NULL correctly
- rend_cache_entry_free(NULL);
+ rend_cache_entry_free_(NULL);
// Handles NULL descriptor correctly
e = tor_malloc_zero(sizeof(rend_cache_entry_t));
@@ -1135,7 +1135,7 @@ test_rend_cache_failure_intro_entry_free(void *data)
rend_cache_failure_intro_t *entry;
// Handles a null argument
- rend_cache_failure_intro_entry_free(NULL);
+ rend_cache_failure_intro_entry_free_(NULL);
// Handles a non-null argument
entry = rend_cache_failure_intro_entry_new(INTRO_POINT_FAILURE_TIMEOUT);
@@ -1148,7 +1148,7 @@ test_rend_cache_failure_purge(void *data)
(void)data;
// Handles a null failure cache
- strmap_free(rend_cache_failure, rend_cache_failure_entry_free_);
+ strmap_free(rend_cache_failure, rend_cache_failure_entry_free_void);
rend_cache_failure = NULL;
rend_cache_failure_purge();
diff --git a/src/test/test_replay.c b/src/test/test_replay.c
index c379cafa7c..d8dcc7370c 100644
--- a/src/test/test_replay.c
+++ b/src/test/test_replay.c
@@ -74,7 +74,7 @@ static void
test_replaycache_free_null(void *arg)
{
(void)arg;
- replaycache_free(NULL);
+ replaycache_free_(NULL);
/* Assert that we're here without horrible death */
tt_assert(1);
diff --git a/src/test/test_routerlist.c b/src/test/test_routerlist.c
index fd29e8f172..c19d66ef9d 100644
--- a/src/test/test_routerlist.c
+++ b/src/test/test_routerlist.c
@@ -520,7 +520,7 @@ test_directory_guard_fetch_with_no_dirinfo(void *arg)
done:
tor_free(consensus_text_md);
tor_free(dummy_state);
- connection_free_(TO_CONN(conn));
+ connection_free_minimal(TO_CONN(conn));
entry_guards_free_all();
teardown_capture_of_logs();
}
diff --git a/src/test/test_routerset.c b/src/test/test_routerset.c
index 6da2275c35..c541324674 100644
--- a/src/test/test_routerset.c
+++ b/src/test/test_routerset.c
@@ -699,7 +699,7 @@ NS(test_main)(void *arg)
static void
NS(test_main)(void *arg)
{
- const routerset_t *set;
+ routerset_t *set;
int needs_geoip;
(void)arg;
@@ -709,14 +709,14 @@ NS(test_main)(void *arg)
set = routerset_new();
needs_geoip = routerset_needs_geoip(set);
- routerset_free((routerset_t *)set);
+ routerset_free(set);
tt_int_op(needs_geoip, OP_EQ, 0);
set = NULL;
set = routerset_new();
smartlist_add(set->country_names, tor_strndup("xx", 2));
needs_geoip = routerset_needs_geoip(set);
- routerset_free((routerset_t *)set);
+ routerset_free(set);
set = NULL;
tt_int_op(needs_geoip, OP_NE, 0);
@@ -1947,7 +1947,7 @@ NS(test_main)(void *arg)
done:
tor_free(s);
- routerset_free((routerset_t *)set);
+ routerset_free(set);
}
#undef NS_SUBMODULE
@@ -2084,28 +2084,28 @@ NS(test_main)(void *arg)
* Structural test for routerset_free, where the routerset is NULL.
*/
-NS_DECL(void, smartlist_free, (smartlist_t *sl));
+NS_DECL(void, smartlist_free_, (smartlist_t *sl));
static void
NS(test_main)(void *arg)
{
(void)arg;
- NS_MOCK(smartlist_free);
+ NS_MOCK(smartlist_free_);
- routerset_free(NULL);
+ routerset_free_(NULL);
- tt_int_op(CALLED(smartlist_free), OP_EQ, 0);
+ tt_int_op(CALLED(smartlist_free_), OP_EQ, 0);
done:
;
}
void
-NS(smartlist_free)(smartlist_t *s)
+NS(smartlist_free_)(smartlist_t *s)
{
(void)s;
- CALLED(smartlist_free)++;
+ CALLED(smartlist_free_)++;
}
#undef NS_SUBMODULE
@@ -2115,9 +2115,9 @@ NS(smartlist_free)(smartlist_t *s)
* Structural test for routerset_free.
*/
-NS_DECL(void, smartlist_free, (smartlist_t *sl));
-NS_DECL(void, strmap_free,(strmap_t *map, void (*free_val)(void*)));
-NS_DECL(void, digestmap_free, (digestmap_t *map, void (*free_val)(void*)));
+NS_DECL(void, smartlist_free_, (smartlist_t *sl));
+NS_DECL(void, strmap_free_,(strmap_t *map, void (*free_val)(void*)));
+NS_DECL(void, digestmap_free_, (digestmap_t *map, void (*free_val)(void*)));
static void
NS(test_main)(void *arg)
@@ -2125,39 +2125,39 @@ NS(test_main)(void *arg)
routerset_t *routerset = routerset_new();
(void)arg;
- NS_MOCK(smartlist_free);
- NS_MOCK(strmap_free);
- NS_MOCK(digestmap_free);
+ NS_MOCK(smartlist_free_);
+ NS_MOCK(strmap_free_);
+ NS_MOCK(digestmap_free_);
routerset_free(routerset);
- tt_int_op(CALLED(smartlist_free), OP_NE, 0);
- tt_int_op(CALLED(strmap_free), OP_NE, 0);
- tt_int_op(CALLED(digestmap_free), OP_NE, 0);
+ tt_int_op(CALLED(smartlist_free_), OP_NE, 0);
+ tt_int_op(CALLED(strmap_free_), OP_NE, 0);
+ tt_int_op(CALLED(digestmap_free_), OP_NE, 0);
done:
;
}
void
-NS(smartlist_free)(smartlist_t *s)
+NS(smartlist_free_)(smartlist_t *s)
{
- CALLED(smartlist_free)++;
- smartlist_free__real(s);
+ CALLED(smartlist_free_)++;
+ smartlist_free___real(s);
}
void
-NS(strmap_free)(strmap_t *map, void (*free_val)(void*))
+NS(strmap_free_)(strmap_t *map, void (*free_val)(void*))
{
- CALLED(strmap_free)++;
- strmap_free__real(map, free_val);
+ CALLED(strmap_free_)++;
+ strmap_free___real(map, free_val);
}
void
-NS(digestmap_free)(digestmap_t *map, void (*free_val)(void*))
+NS(digestmap_free_)(digestmap_t *map, void (*free_val)(void*))
{
- CALLED(digestmap_free)++;
- digestmap_free__real(map, free_val);
+ CALLED(digestmap_free_)++;
+ digestmap_free___real(map, free_val);
}
#undef NS_SUBMODULE
diff --git a/src/test/test_shared_random.c b/src/test/test_shared_random.c
index b0278e8a1d..96494904e3 100644
--- a/src/test/test_shared_random.c
+++ b/src/test/test_shared_random.c
@@ -1351,7 +1351,7 @@ test_state_update(void *arg)
tt_assert(state->current_srv);
done:
- sr_state_free();
+ sr_state_free_all();
UNMOCK(get_my_v3_authority_cert);
}