mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 21:23:58 +01:00
test: Fix memleaks
Signed-off-by: David Goulet <dgoulet@torproject.org>
This commit is contained in:
parent
52c40330c8
commit
59072d2027
@ -1494,9 +1494,6 @@ helper_test_hsdir_sync(networkstatus_t *ns,
|
|||||||
* the client was also picked by service.
|
* the client was also picked by service.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
cleanup_nodelist();
|
|
||||||
smartlist_clear(ns->routerstatus_list);
|
|
||||||
|
|
||||||
/* 1) Initialize service time: consensus and real time */
|
/* 1) Initialize service time: consensus and real time */
|
||||||
time_t now = helper_set_consensus_and_system_time(ns,
|
time_t now = helper_set_consensus_and_system_time(ns,
|
||||||
service_between_srv_and_tp);
|
service_between_srv_and_tp);
|
||||||
@ -1508,6 +1505,8 @@ helper_test_hsdir_sync(networkstatus_t *ns,
|
|||||||
|
|
||||||
/* Now let's upload our desc to all hsdirs */
|
/* Now let's upload our desc to all hsdirs */
|
||||||
upload_descriptor_to_all(service, desc);
|
upload_descriptor_to_all(service, desc);
|
||||||
|
/* Cleanup right now so we don't memleak on error. */
|
||||||
|
cleanup_nodelist();
|
||||||
/* Check that previous hsdirs were populated */
|
/* Check that previous hsdirs were populated */
|
||||||
tt_int_op(smartlist_len(desc->previous_hsdirs), OP_EQ, 6);
|
tt_int_op(smartlist_len(desc->previous_hsdirs), OP_EQ, 6);
|
||||||
|
|
||||||
@ -1515,6 +1514,8 @@ helper_test_hsdir_sync(networkstatus_t *ns,
|
|||||||
now = helper_set_consensus_and_system_time(ns, client_between_srv_and_tp);
|
now = helper_set_consensus_and_system_time(ns, client_between_srv_and_tp);
|
||||||
|
|
||||||
cleanup_nodelist();
|
cleanup_nodelist();
|
||||||
|
SMARTLIST_FOREACH(ns->routerstatus_list,
|
||||||
|
routerstatus_t *, rs, routerstatus_free(rs));
|
||||||
smartlist_clear(ns->routerstatus_list);
|
smartlist_clear(ns->routerstatus_list);
|
||||||
helper_initialize_big_hash_ring(ns);
|
helper_initialize_big_hash_ring(ns);
|
||||||
|
|
||||||
@ -1522,6 +1523,8 @@ helper_test_hsdir_sync(networkstatus_t *ns,
|
|||||||
char client_hsdir_b64_digest[BASE64_DIGEST_LEN+1] = {0};
|
char client_hsdir_b64_digest[BASE64_DIGEST_LEN+1] = {0};
|
||||||
helper_client_pick_hsdir(&service->keys.identity_pk,
|
helper_client_pick_hsdir(&service->keys.identity_pk,
|
||||||
client_hsdir_b64_digest);
|
client_hsdir_b64_digest);
|
||||||
|
/* Cleanup right now so we don't memleak on error. */
|
||||||
|
cleanup_nodelist();
|
||||||
|
|
||||||
/* CHECK: Go through the hsdirs chosen by the service and make sure that it
|
/* CHECK: Go through the hsdirs chosen by the service and make sure that it
|
||||||
* contains the one picked by the client! */
|
* contains the one picked by the client! */
|
||||||
@ -1534,6 +1537,9 @@ helper_test_hsdir_sync(networkstatus_t *ns,
|
|||||||
* need it for next scenario. */
|
* need it for next scenario. */
|
||||||
hs_service_free_all();
|
hs_service_free_all();
|
||||||
hs_service_init();
|
hs_service_init();
|
||||||
|
SMARTLIST_FOREACH(ns->routerstatus_list,
|
||||||
|
routerstatus_t *, rs, routerstatus_free(rs));
|
||||||
|
smartlist_clear(ns->routerstatus_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This test ensures that client and service will pick the same HSDirs, under
|
/** This test ensures that client and service will pick the same HSDirs, under
|
||||||
@ -1643,9 +1649,6 @@ test_client_service_hsdir_set_sync(void *arg)
|
|||||||
helper_test_hsdir_sync(ns, 0, 1, 0);
|
helper_test_hsdir_sync(ns, 0, 1, 0);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
SMARTLIST_FOREACH(ns->routerstatus_list,
|
|
||||||
routerstatus_t *, rs, routerstatus_free(rs));
|
|
||||||
smartlist_clear(ns->routerstatus_list);
|
|
||||||
networkstatus_vote_free(ns);
|
networkstatus_vote_free(ns);
|
||||||
nodelist_free_all();
|
nodelist_free_all();
|
||||||
hs_free_all();
|
hs_free_all();
|
||||||
|
@ -197,8 +197,8 @@ test_nodelist_ed_id(void *arg)
|
|||||||
tor_free(ri[i]->cache_info.signing_key_cert);
|
tor_free(ri[i]->cache_info.signing_key_cert);
|
||||||
tor_free(ri[i]);
|
tor_free(ri[i]);
|
||||||
}
|
}
|
||||||
smartlist_free(ns->routerstatus_list);
|
smartlist_clear(ns->routerstatus_list);
|
||||||
tor_free(ns);
|
networkstatus_vote_free(ns);
|
||||||
UNMOCK(networkstatus_get_latest_consensus);
|
UNMOCK(networkstatus_get_latest_consensus);
|
||||||
UNMOCK(networkstatus_get_latest_consensus_by_flavor);
|
UNMOCK(networkstatus_get_latest_consensus_by_flavor);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user