aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_hs_pow.c
diff options
context:
space:
mode:
authorMicah Elizabeth Scott <beth@torproject.org>2023-03-27 16:18:26 -0700
committerMicah Elizabeth Scott <beth@torproject.org>2023-05-10 07:38:29 -0700
commitac466a22195f8d550a8612bb89583c5e58eadb1a (patch)
tree47960d33a6d84f4011bc9b223f33c3310ae3e7d8 /src/test/test_hs_pow.c
parentac29c7209dbdaf0d317f1c4eb67d5e330386552b (diff)
downloadtor-ac466a22195f8d550a8612bb89583c5e58eadb1a.tar.gz
tor-ac466a22195f8d550a8612bb89583c5e58eadb1a.zip
hs_pow: leak fix, free the contents of pqueue entries in hs_pow_free_service_state
Asan catches this pretty readily when ending a service gracefully while a DoS is in progress and the queue is full of items that haven't yet timed out. The module boundaries in hs_circuit are quite fuzzy here, but I'm trying to follow the vibe of the existing hs_pow code. Signed-off-by: Micah Elizabeth Scott <beth@torproject.org>
Diffstat (limited to 'src/test/test_hs_pow.c')
-rw-r--r--src/test/test_hs_pow.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/test/test_hs_pow.c b/src/test/test_hs_pow.c
index ca470e2b5d..909a2b569e 100644
--- a/src/test/test_hs_pow.c
+++ b/src/test/test_hs_pow.c
@@ -194,7 +194,7 @@ testing_hs_pow_service_free(testing_hs_pow_service_t *tsvc)
hs_metrics_service_free(&tsvc->service);
service_intro_point_free(tsvc->service_ip);
hs_desc_intro_point_free(tsvc->desc_ip);
- tor_free(tsvc->service.state.pow_state);
+ hs_pow_free_service_state(tsvc->service.state.pow_state);
tor_free(tsvc);
if (fake_node) {
@@ -343,6 +343,7 @@ test_hs_pow_vectors(void *arg)
testing_hs_pow_service_t *tsvc = testing_hs_pow_service_new();
hs_pow_service_state_t *pow_state = tor_malloc_zero(sizeof *pow_state);
tsvc->service.state.pow_state = pow_state;
+ pow_state->rend_request_pqueue = smartlist_new();
char *mem_op_hex_tmp = NULL;
uint8_t *decrypted = NULL;