aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-11-21 08:29:42 -0500
committerNick Mathewson <nickm@torproject.org>2017-12-08 14:47:19 -0500
commitb0cc9856ee560865d2668afbff20e8b77986e4ee (patch)
tree3411bb448b33a9f256020784e28aa62fe338b14d /src/test
parentc92ac9f5cbb4440b5f87c7e0dd6bec5147d72405 (diff)
downloadtor-b0cc9856ee560865d2668afbff20e8b77986e4ee.tar.gz
tor-b0cc9856ee560865d2668afbff20e8b77986e4ee.zip
Update free functions into macros: src/or/ part 1
This covers addressmap.h (no change needed) through confparse.h
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test.c4
-rw-r--r--src/test/test_cell_queue.c4
-rw-r--r--src/test/test_circuitlist.c28
-rw-r--r--src/test/test_entrynodes.c4
-rw-r--r--src/test/test_hs_client.c4
-rw-r--r--src/test/test_hs_intropoint.c38
-rw-r--r--src/test/test_hs_service.c16
7 files changed, 49 insertions, 49 deletions
diff --git a/src/test/test.c b/src/test/test.c
index 00857c2386..1c5b654df2 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);
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_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_entrynodes.c b/src/test/test_entrynodes.c
index 43cc394888..564b992b98 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_hs_client.c b/src/test/test_hs_client.c
index 750920fac0..6e2d956b4e 100644
--- a/src/test/test_hs_client.c
+++ b/src/test/test_hs_client.c
@@ -230,7 +230,7 @@ test_e2e_rend_circuit_setup_legacy(void *arg)
connection_free_(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. */
@@ -300,7 +300,7 @@ test_e2e_rend_circuit_setup(void *arg)
connection_free_(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
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_);