Rename connection_free_ to connection_free_minimal.

This commit is contained in:
Nick Mathewson 2017-11-21 08:36:08 -05:00
parent b0cc9856ee
commit a48ba072a9
10 changed files with 91 additions and 90 deletions

View File

@ -499,7 +499,7 @@ conn_listener_type_supports_af_unix(int type)
* if <b>conn</b> is an OR or OP connection. * if <b>conn</b> is an OR or OP connection.
*/ */
STATIC void STATIC void
connection_free_(connection_t *conn) connection_free_minimal(connection_t *conn)
{ {
void *mem; void *mem;
size_t memlen; size_t memlen;
@ -704,7 +704,7 @@ connection_free,(connection_t *conn))
} }
#endif /* 1 */ #endif /* 1 */
connection_unregister_events(conn); connection_unregister_events(conn);
connection_free_(conn); connection_free_minimal(conn);
} }
/** /**
@ -5239,8 +5239,8 @@ proxy_type_to_string(int proxy_type)
return NULL; /*Unreached*/ return NULL; /*Unreached*/
} }
/** Call connection_free_() on every connection in our array, and release all /** Call connection_free_minimal() on every connection in our array, and
* storage held by connection.c. * release all storage held by connection.c.
* *
* Don't do the checks in connection_free(), because they will * Don't do the checks in connection_free(), because they will
* fail. * fail.
@ -5264,7 +5264,8 @@ connection_free_all(void)
/* Clear out our list of broken connections */ /* Clear out our list of broken connections */
clear_broken_connection_map(0); clear_broken_connection_map(0);
SMARTLIST_FOREACH(conns, connection_t *, conn, connection_free_(conn)); SMARTLIST_FOREACH(conns, connection_t *, conn,
connection_free_minimal(conn));
if (outgoing_addrs) { if (outgoing_addrs) {
SMARTLIST_FOREACH(outgoing_addrs, tor_addr_t *, addr, tor_free(addr)); SMARTLIST_FOREACH(outgoing_addrs, tor_addr_t *, addr, tor_free(addr));

View File

@ -267,7 +267,7 @@ connection_is_moribund(connection_t *conn)
void connection_check_oos(int n_socks, int failed); void connection_check_oos(int n_socks, int failed);
#ifdef CONNECTION_PRIVATE #ifdef CONNECTION_PRIVATE
STATIC void connection_free_(connection_t *conn); STATIC void connection_free_minimal(connection_t *conn);
/* Used only by connection.c and test*.c */ /* Used only by connection.c and test*.c */
uint32_t bucket_millis_empty(int tokens_before, uint32_t last_empty_time, uint32_t bucket_millis_empty(int tokens_before, uint32_t last_empty_time,

View File

@ -88,7 +88,7 @@ test_dir_handle_get_bad_request(void *data)
done: done:
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
tor_free(header); tor_free(header);
} }
@ -117,7 +117,7 @@ test_dir_handle_get_v1_command_not_found(void *data)
done: done:
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
tor_free(header); tor_free(header);
} }
@ -164,7 +164,7 @@ test_dir_handle_get_v1_command(void *data)
done: done:
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
UNMOCK(get_dirportfrontpage); UNMOCK(get_dirportfrontpage);
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
tor_free(header); tor_free(header);
tor_free(body); tor_free(body);
} }
@ -190,7 +190,7 @@ test_dir_handle_get_not_found(void *data)
done: done:
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
tor_free(header); tor_free(header);
} }
@ -225,7 +225,7 @@ test_dir_handle_get_robots_txt(void *data)
done: done:
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
tor_free(header); tor_free(header);
tor_free(body); tor_free(body);
} }
@ -254,7 +254,7 @@ test_dir_handle_get_rendezvous2_not_found_if_not_encrypted(void *data)
done: done:
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
tor_free(header); tor_free(header);
} }
@ -282,7 +282,7 @@ test_dir_handle_get_rendezvous2_on_encrypted_conn_with_invalid_desc_id(
done: done:
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
tor_free(header); tor_free(header);
} }
@ -315,7 +315,7 @@ test_dir_handle_get_rendezvous2_on_encrypted_conn_not_well_formed(void *data)
done: done:
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
tor_free(header); tor_free(header);
} }
@ -344,7 +344,7 @@ test_dir_handle_get_rendezvous2_not_found(void *data)
done: done:
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
tor_free(header); tor_free(header);
rend_cache_free_all(); 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_); UNMOCK(connection_write_to_buf_impl_);
NS_UNMOCK(router_get_my_routerinfo); NS_UNMOCK(router_get_my_routerinfo);
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
tor_free(header); tor_free(header);
tor_free(body); tor_free(body);
rend_encoded_v2_service_descriptor_free(desc_holder); rend_encoded_v2_service_descriptor_free(desc_holder);
@ -457,7 +457,7 @@ test_dir_handle_get_micro_d_not_found(void *data)
done: done:
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
tor_free(header); tor_free(header);
} }
@ -541,7 +541,7 @@ test_dir_handle_get_micro_d(void *data)
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
or_options_free(mock_options); mock_options = NULL; or_options_free(mock_options); mock_options = NULL;
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
tor_free(header); tor_free(header);
tor_free(body); tor_free(body);
smartlist_free(list); smartlist_free(list);
@ -595,7 +595,7 @@ test_dir_handle_get_micro_d_server_busy(void *data)
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
or_options_free(mock_options); mock_options = NULL; or_options_free(mock_options); mock_options = NULL;
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
tor_free(header); tor_free(header);
smartlist_free(list); smartlist_free(list);
microdesc_free_all(); microdesc_free_all();
@ -632,7 +632,7 @@ test_dir_handle_get_networkstatus_bridges_not_found_without_auth(void *data)
UNMOCK(get_options); UNMOCK(get_options);
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
or_options_free(mock_options); mock_options = NULL; or_options_free(mock_options); mock_options = NULL;
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
tor_free(header); tor_free(header);
} }
@ -672,7 +672,7 @@ test_dir_handle_get_networkstatus_bridges(void *data)
UNMOCK(get_options); UNMOCK(get_options);
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
or_options_free(mock_options); mock_options = NULL; or_options_free(mock_options); mock_options = NULL;
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
tor_free(header); tor_free(header);
} }
@ -709,7 +709,7 @@ test_dir_handle_get_networkstatus_bridges_not_found_wrong_auth(void *data)
UNMOCK(get_options); UNMOCK(get_options);
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
or_options_free(mock_options); mock_options = NULL; or_options_free(mock_options); mock_options = NULL;
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
tor_free(header); tor_free(header);
} }
@ -737,7 +737,7 @@ test_dir_handle_get_server_descriptors_not_found(void* data)
done: done:
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
or_options_free(mock_options); mock_options = NULL; or_options_free(mock_options); mock_options = NULL;
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
tor_free(header); tor_free(header);
} }
@ -798,7 +798,7 @@ test_dir_handle_get_server_descriptors_all(void* data)
done: done:
NS_UNMOCK(router_get_my_routerinfo); NS_UNMOCK(router_get_my_routerinfo);
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
tor_free(header); tor_free(header);
tor_free(body); tor_free(body);
@ -902,7 +902,7 @@ test_dir_handle_get_server_descriptors_authority(void* data)
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
tor_free(mock_routerinfo->cache_info.signed_descriptor_body); tor_free(mock_routerinfo->cache_info.signed_descriptor_body);
tor_free(mock_routerinfo); tor_free(mock_routerinfo);
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
tor_free(header); tor_free(header);
tor_free(body); tor_free(body);
crypto_pk_free(identity_pkey); crypto_pk_free(identity_pkey);
@ -974,7 +974,7 @@ test_dir_handle_get_server_descriptors_fp(void* data)
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
tor_free(mock_routerinfo->cache_info.signed_descriptor_body); tor_free(mock_routerinfo->cache_info.signed_descriptor_body);
tor_free(mock_routerinfo); tor_free(mock_routerinfo);
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
tor_free(header); tor_free(header);
tor_free(body); tor_free(body);
crypto_pk_free(identity_pkey); crypto_pk_free(identity_pkey);
@ -1038,7 +1038,7 @@ test_dir_handle_get_server_descriptors_d(void* data)
done: done:
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
tor_free(mock_routerinfo); tor_free(mock_routerinfo);
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
tor_free(header); tor_free(header);
tor_free(body); tor_free(body);
crypto_pk_free(identity_pkey); crypto_pk_free(identity_pkey);
@ -1094,7 +1094,7 @@ test_dir_handle_get_server_descriptors_busy(void* data)
UNMOCK(get_options); UNMOCK(get_options);
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
tor_free(mock_routerinfo); tor_free(mock_routerinfo);
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
tor_free(header); tor_free(header);
crypto_pk_free(identity_pkey); crypto_pk_free(identity_pkey);
@ -1125,7 +1125,7 @@ test_dir_handle_get_server_keys_bad_req(void* data)
done: done:
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
tor_free(header); tor_free(header);
} }
@ -1151,7 +1151,7 @@ test_dir_handle_get_server_keys_all_not_found(void* data)
done: done:
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
tor_free(header); tor_free(header);
} }
@ -1210,7 +1210,7 @@ test_dir_handle_get_server_keys_all(void* data)
done: done:
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
tor_free(header); tor_free(header);
tor_free(body); tor_free(body);
@ -1240,7 +1240,7 @@ test_dir_handle_get_server_keys_authority_not_found(void* data)
done: done:
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
tor_free(header); tor_free(header);
} }
@ -1288,7 +1288,7 @@ test_dir_handle_get_server_keys_authority(void* data)
done: done:
UNMOCK(get_my_v3_authority_cert); UNMOCK(get_my_v3_authority_cert);
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
tor_free(header); tor_free(header);
tor_free(body); tor_free(body);
authority_cert_free(mock_cert); mock_cert = NULL; authority_cert_free(mock_cert); mock_cert = NULL;
@ -1316,7 +1316,7 @@ test_dir_handle_get_server_keys_fp_not_found(void* data)
done: done:
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
tor_free(header); tor_free(header);
} }
@ -1370,7 +1370,7 @@ test_dir_handle_get_server_keys_fp(void* data)
done: done:
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
tor_free(header); tor_free(header);
tor_free(body); tor_free(body);
clear_dir_servers(); clear_dir_servers();
@ -1399,7 +1399,7 @@ test_dir_handle_get_server_keys_sk_not_found(void* data)
done: done:
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
tor_free(header); tor_free(header);
} }
@ -1444,7 +1444,7 @@ test_dir_handle_get_server_keys_sk(void* data)
done: done:
UNMOCK(get_my_v3_authority_cert); UNMOCK(get_my_v3_authority_cert);
UNMOCK(connection_write_to_buf_impl_); 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; authority_cert_free(mock_cert); mock_cert = NULL;
tor_free(header); tor_free(header);
tor_free(body); tor_free(body);
@ -1472,7 +1472,7 @@ test_dir_handle_get_server_keys_fpsk_not_found(void* data)
done: done:
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
tor_free(header); tor_free(header);
} }
@ -1529,7 +1529,7 @@ test_dir_handle_get_server_keys_fpsk(void* data)
done: done:
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
tor_free(header); tor_free(header);
tor_free(body); tor_free(body);
@ -1583,7 +1583,7 @@ test_dir_handle_get_server_keys_busy(void* data)
done: done:
UNMOCK(get_options); UNMOCK(get_options);
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
tor_free(header); tor_free(header);
or_options_free(mock_options); mock_options = NULL; or_options_free(mock_options); mock_options = NULL;
@ -1649,7 +1649,7 @@ test_dir_handle_get_status_vote_current_consensus_ns_not_enough_sigs(void* d)
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
UNMOCK(get_options); UNMOCK(get_options);
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
tor_free(header); tor_free(header);
tor_free(stats); tor_free(stats);
smartlist_free(mock_ns_val->voters); smartlist_free(mock_ns_val->voters);
@ -1690,7 +1690,7 @@ test_dir_handle_get_status_vote_current_consensus_ns_not_found(void* data)
done: done:
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
UNMOCK(get_options); UNMOCK(get_options);
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
tor_free(header); tor_free(header);
tor_free(stats); tor_free(stats);
or_options_free(mock_options); mock_options = NULL; or_options_free(mock_options); mock_options = NULL;
@ -1764,7 +1764,7 @@ test_dir_handle_get_status_vote_current_consensus_too_old(void *data)
UNMOCK(networkstatus_get_latest_consensus_by_flavor); UNMOCK(networkstatus_get_latest_consensus_by_flavor);
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
UNMOCK(get_options); UNMOCK(get_options);
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
tor_free(header); tor_free(header);
tor_free(mock_ns_val); tor_free(mock_ns_val);
or_options_free(mock_options); mock_options = NULL; or_options_free(mock_options); mock_options = NULL;
@ -1825,7 +1825,7 @@ status_vote_current_consensus_ns_test(char **header, char **body,
done: done:
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
} }
static void static void
@ -1948,7 +1948,7 @@ test_dir_handle_get_status_vote_current_not_found(void* data)
done: done:
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
tor_free(header); tor_free(header);
} }
@ -1971,7 +1971,7 @@ status_vote_current_d_test(char **header, char **body, size_t *body_l)
done: done:
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
} }
static void static void
@ -1991,7 +1991,7 @@ status_vote_next_d_test(char **header, char **body, size_t *body_l)
done: done:
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
} }
static void static void
@ -2116,7 +2116,7 @@ test_dir_handle_get_status_vote_next_not_found(void* data)
done: done:
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
tor_free(header); tor_free(header);
} }
@ -2135,7 +2135,7 @@ status_vote_next_consensus_test(char **header, char **body, size_t *body_used)
body, body_used, 18, 0); body, body_used, 18, 0);
done: done:
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
} }
static void static void
@ -2175,7 +2175,7 @@ test_dir_handle_get_status_vote_current_authority_not_found(void* data)
done: done:
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
tor_free(header); tor_free(header);
} }
@ -2199,7 +2199,7 @@ test_dir_handle_get_status_vote_next_authority_not_found(void* data)
done: done:
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
tor_free(header); tor_free(header);
} }
@ -2281,7 +2281,7 @@ status_vote_next_consensus_signatures_test(char **header, char **body,
body, body_used, 22, 0); body, body_used, 22, 0);
done: done:
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
} }
@ -2429,7 +2429,7 @@ test_dir_handle_get_status_vote_next_authority(void* data)
done: done:
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
UNMOCK(get_my_v3_authority_cert); UNMOCK(get_my_v3_authority_cert);
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
tor_free(header); tor_free(header);
tor_free(body); tor_free(body);
authority_cert_free(mock_cert); mock_cert = NULL; authority_cert_free(mock_cert); mock_cert = NULL;
@ -2511,7 +2511,7 @@ test_dir_handle_get_status_vote_current_authority(void* data)
done: done:
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
UNMOCK(get_my_v3_authority_cert); UNMOCK(get_my_v3_authority_cert);
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
tor_free(header); tor_free(header);
tor_free(body); tor_free(body);
authority_cert_free(mock_cert); mock_cert = NULL; authority_cert_free(mock_cert); mock_cert = NULL;

View File

@ -34,7 +34,7 @@ entryconn_rewrite_teardown(const struct testcase_t *tc, void *arg)
(void)tc; (void)tc;
entry_connection_t *ec = arg; entry_connection_t *ec = arg;
if (ec) if (ec)
connection_free_(ENTRY_TO_CONN(ec)); connection_free_minimal(ENTRY_TO_CONN(ec));
addressmap_free_all(); addressmap_free_all();
return 1; return 1;
} }
@ -156,8 +156,8 @@ test_entryconn_rewrite_automap_ipv4(void *arg)
ec->socks_request->address); ec->socks_request->address);
done: done:
connection_free_(ENTRY_TO_CONN(ec2)); connection_free_minimal(ENTRY_TO_CONN(ec2));
connection_free_(ENTRY_TO_CONN(ec3)); connection_free_minimal(ENTRY_TO_CONN(ec3));
} }
/* Automap on resolve, connect to automapped address, resolve again and get /* 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); ec->socks_request->address);
done: done:
connection_free_(ENTRY_TO_CONN(ec)); connection_free_minimal(ENTRY_TO_CONN(ec));
connection_free_(ENTRY_TO_CONN(ec2)); connection_free_minimal(ENTRY_TO_CONN(ec2));
connection_free_(ENTRY_TO_CONN(ec3)); connection_free_minimal(ENTRY_TO_CONN(ec3));
} }
#if 0 #if 0
@ -283,7 +283,7 @@ test_entryconn_rewrite_automap_reverse(void *arg)
tt_int_op(rr.exit_source, OP_EQ, ADDRMAPSRC_NONE); tt_int_op(rr.exit_source, OP_EQ, ADDRMAPSRC_NONE);
done: done:
connection_free_(ENTRY_TO_CONN(ec2)); connection_free_minimal(ENTRY_TO_CONN(ec2));
} }
#endif /* 0 */ #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"); tt_str_op(ec2->socks_request->address, OP_EQ, "240.240.241.241");
done: done:
connection_free_(ENTRY_TO_CONN(ec2)); connection_free_minimal(ENTRY_TO_CONN(ec2));
} }
/* Rewrite because of cached DNS entry. */ /* 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]"); tt_str_op(ec2->socks_request->address, OP_EQ, "[::f00f]");
done: done:
connection_free_(ENTRY_TO_CONN(ec)); connection_free_minimal(ENTRY_TO_CONN(ec));
connection_free_(ENTRY_TO_CONN(ec2)); connection_free_minimal(ENTRY_TO_CONN(ec2));
} }
/* Fail to connect to unmapped address in virtual range. */ /* 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); tt_int_op(rr.exit_source, OP_EQ, ADDRMAPSRC_NONE);
done: done:
connection_free_(ENTRY_TO_CONN(ec2)); connection_free_minimal(ENTRY_TO_CONN(ec2));
} }
/* Rewrite because of mapaddress option */ /* 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); tt_int_op(rr.end_reason, OP_EQ, END_STREAM_REASON_TORPROTOCOL);
done: done:
connection_free_(ENTRY_TO_CONN(ec2)); connection_free_minimal(ENTRY_TO_CONN(ec2));
} }
/* Rewrite into .exit because of mapaddress */ /* Rewrite into .exit because of mapaddress */
@ -618,9 +618,9 @@ test_entryconn_rewrite_mapaddress_automap_onion(void *arg)
*/ */
done: done:
connection_free_(ENTRY_TO_CONN(ec2)); connection_free_minimal(ENTRY_TO_CONN(ec2));
connection_free_(ENTRY_TO_CONN(ec3)); connection_free_minimal(ENTRY_TO_CONN(ec3));
connection_free_(ENTRY_TO_CONN(ec4)); connection_free_minimal(ENTRY_TO_CONN(ec4));
} }
static void static void
@ -678,8 +678,8 @@ test_entryconn_rewrite_mapaddress_automap_onion_common(entry_connection_t *ec,
"abcdefghijklmnop.onion")); "abcdefghijklmnop.onion"));
done: done:
connection_free_(ENTRY_TO_CONN(ec2)); connection_free_minimal(ENTRY_TO_CONN(ec2));
connection_free_(ENTRY_TO_CONN(ec3)); connection_free_minimal(ENTRY_TO_CONN(ec3));
} }
/* This time is the same, but we start with a mapping from a non-onion /* This time is the same, but we start with a mapping from a non-onion

View File

@ -58,11 +58,11 @@ test_ext_or_id_map(void *arg)
done: done:
if (c1) if (c1)
connection_free_(TO_CONN(c1)); connection_free_minimal(TO_CONN(c1));
if (c2) if (c2)
connection_free_(TO_CONN(c2)); connection_free_minimal(TO_CONN(c2));
if (c3) if (c3)
connection_free_(TO_CONN(c3)); connection_free_minimal(TO_CONN(c3));
tor_free(idp); tor_free(idp);
tor_free(idp2); tor_free(idp2);
connection_or_clear_ext_or_id_map(); connection_or_clear_ext_or_id_map();
@ -145,7 +145,7 @@ test_ext_or_write_command(void *arg)
done: done:
if (c1) if (c1)
connection_free_(TO_CONN(c1)); connection_free_minimal(TO_CONN(c1));
tor_free(cp); tor_free(cp);
tor_free(buf); tor_free(buf);
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
@ -591,7 +591,7 @@ test_ext_or_handshake(void *arg)
UNMOCK(connection_write_to_buf_impl_); UNMOCK(connection_write_to_buf_impl_);
UNMOCK(crypto_rand); UNMOCK(crypto_rand);
if (conn) if (conn)
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
#undef CONTAINS #undef CONTAINS
#undef WRITE #undef WRITE
} }

View File

@ -259,7 +259,7 @@ helper_fetch_desc_from_hsdir(const ed25519_public_key_t *blinded_key)
done: done:
tor_free(hsdir_query_str); tor_free(hsdir_query_str);
if (conn) if (conn)
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
return received_desc; return received_desc;
} }

View File

@ -227,7 +227,7 @@ test_e2e_rend_circuit_setup_legacy(void *arg)
tt_ptr_op(TO_EDGE_CONN(conn)->on_circuit, OP_EQ, TO_CIRCUIT(or_circ)); tt_ptr_op(TO_EDGE_CONN(conn)->on_circuit, OP_EQ, TO_CIRCUIT(or_circ));
done: done:
connection_free_(conn); connection_free_minimal(conn);
if (or_circ) if (or_circ)
tor_free(TO_CIRCUIT(or_circ)->n_chan); tor_free(TO_CIRCUIT(or_circ)->n_chan);
circuit_free_(TO_CIRCUIT(or_circ)); circuit_free_(TO_CIRCUIT(or_circ));
@ -297,7 +297,7 @@ test_e2e_rend_circuit_setup(void *arg)
tt_ptr_op(TO_EDGE_CONN(conn)->on_circuit, OP_EQ, TO_CIRCUIT(or_circ)); tt_ptr_op(TO_EDGE_CONN(conn)->on_circuit, OP_EQ, TO_CIRCUIT(or_circ));
done: done:
connection_free_(conn); connection_free_minimal(conn);
if (or_circ) if (or_circ)
tor_free(TO_CIRCUIT(or_circ)->n_chan); tor_free(TO_CIRCUIT(or_circ)->n_chan);
circuit_free_(TO_CIRCUIT(or_circ)); circuit_free_(TO_CIRCUIT(or_circ));
@ -560,7 +560,7 @@ test_descriptor_fetch(void *arg)
smartlist_add(get_connection_array(), TO_CONN(dir_conn)); smartlist_add(get_connection_array(), TO_CONN(dir_conn));
ret = hs_client_refetch_hsdesc(&service_pk); ret = hs_client_refetch_hsdesc(&service_pk);
smartlist_remove(get_connection_array(), TO_CONN(dir_conn)); 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); 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); tt_int_op(ec->edge_.end_reason, OP_EQ, END_STREAM_REASON_RESOLVEFAILED);
done: done:
connection_free_(ENTRY_TO_CONN(ec)); connection_free_minimal(ENTRY_TO_CONN(ec));
UNMOCK(networkstatus_get_live_consensus); UNMOCK(networkstatus_get_live_consensus);
UNMOCK(router_have_minimum_dir_info); UNMOCK(router_have_minimum_dir_info);
hs_free_all(); hs_free_all();

View File

@ -302,8 +302,8 @@ test_link_handshake_certs_ok(void *arg)
mock_own_cert = mock_peer_cert = NULL; mock_own_cert = mock_peer_cert = NULL;
memset(c1->identity_digest, 0, sizeof(c1->identity_digest)); memset(c1->identity_digest, 0, sizeof(c1->identity_digest));
memset(c2->identity_digest, 0, sizeof(c2->identity_digest)); memset(c2->identity_digest, 0, sizeof(c2->identity_digest));
connection_free_(TO_CONN(c1)); connection_free_minimal(TO_CONN(c1));
connection_free_(TO_CONN(c2)); connection_free_minimal(TO_CONN(c2));
tor_free(cell1); tor_free(cell1);
tor_free(cell2); tor_free(cell2);
certs_cell_free(cc1); certs_cell_free(cc1);
@ -343,7 +343,7 @@ recv_certs_cleanup(const struct testcase_t *test, void *obj)
tor_free(d->cell); tor_free(d->cell);
certs_cell_free(d->ccell); certs_cell_free(d->ccell);
connection_or_clear_identity(d->c); 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); circuitmux_free(d->chan->base_.cmux);
tor_free(d->chan); tor_free(d->chan);
crypto_pk_free(d->key1); crypto_pk_free(d->key1);
@ -930,7 +930,7 @@ test_link_handshake_send_authchallenge(void *arg)
done: done:
UNMOCK(connection_or_write_var_cell_to_buf); UNMOCK(connection_or_write_var_cell_to_buf);
connection_free_(TO_CONN(c1)); connection_free_minimal(TO_CONN(c1));
tor_free(cell1); tor_free(cell1);
tor_free(cell2); tor_free(cell2);
crypto_pk_free(rsa0); crypto_pk_free(rsa0);
@ -955,7 +955,7 @@ recv_authchallenge_cleanup(const struct testcase_t *test, void *obj)
if (d) { if (d) {
tor_free(d->cell); tor_free(d->cell);
connection_free_(TO_CONN(d->c)); connection_free_minimal(TO_CONN(d->c));
circuitmux_free(d->chan->base_.cmux); circuitmux_free(d->chan->base_.cmux);
tor_free(d->chan); tor_free(d->chan);
tor_free(d); tor_free(d);
@ -1158,8 +1158,8 @@ authenticate_data_cleanup(const struct testcase_t *test, void *arg)
tor_free(d->cell); tor_free(d->cell);
connection_or_clear_identity(d->c1); connection_or_clear_identity(d->c1);
connection_or_clear_identity(d->c2); connection_or_clear_identity(d->c2);
connection_free_(TO_CONN(d->c1)); connection_free_minimal(TO_CONN(d->c1));
connection_free_(TO_CONN(d->c2)); connection_free_minimal(TO_CONN(d->c2));
circuitmux_free(d->chan2->base_.cmux); circuitmux_free(d->chan2->base_.cmux);
tor_free(d->chan2); tor_free(d->chan2);
crypto_pk_free(d->key1); crypto_pk_free(d->key1);

View File

@ -335,7 +335,7 @@ test_oom_streambuf(void *arg)
circuit_free(c5); circuit_free(c5);
SMARTLIST_FOREACH(edgeconns, edge_connection_t *, ec, SMARTLIST_FOREACH(edgeconns, edge_connection_t *, ec,
connection_free_(TO_CONN(ec))); connection_free_minimal(TO_CONN(ec)));
smartlist_free(edgeconns); smartlist_free(edgeconns);
UNMOCK(circuit_mark_for_close_); UNMOCK(circuit_mark_for_close_);

View File

@ -520,7 +520,7 @@ test_directory_guard_fetch_with_no_dirinfo(void *arg)
done: done:
tor_free(consensus_text_md); tor_free(consensus_text_md);
tor_free(dummy_state); tor_free(dummy_state);
connection_free_(TO_CONN(conn)); connection_free_minimal(TO_CONN(conn));
entry_guards_free_all(); entry_guards_free_all();
teardown_capture_of_logs(); teardown_capture_of_logs();
} }