diff options
author | Nick Mathewson <nickm@torproject.org> | 2015-10-21 08:49:29 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2015-10-21 08:49:29 -0400 |
commit | b7941cbfbb5a121425d9d0c5e1f903efd563a173 (patch) | |
tree | 223de960dc42772862e106f737588c0112aa4366 /src/test/rend_test_helpers.c | |
parent | 2461ea1faa20fc435bdf786147afe99207366c29 (diff) | |
download | tor-b7941cbfbb5a121425d9d0c5e1f903efd563a173.tar.gz tor-b7941cbfbb5a121425d9d0c5e1f903efd563a173.zip |
Fix numerous leaks and memory errors in tests. Found by valgrind
Diffstat (limited to 'src/test/rend_test_helpers.c')
-rw-r--r-- | src/test/rend_test_helpers.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/test/rend_test_helpers.c b/src/test/rend_test_helpers.c index f076d76fd6..f16d67fa1a 100644 --- a/src/test/rend_test_helpers.c +++ b/src/test/rend_test_helpers.c @@ -20,8 +20,12 @@ generate_desc(int time_diff, rend_encoded_v2_service_descriptor_t **desc, rend_encode_v2_descriptors(descs, generated, now, 0, REND_NO_AUTH, NULL, NULL); - *desc = ((rend_encoded_v2_service_descriptor_t *)smartlist_get(descs, 0)); + tor_assert(smartlist_len(descs) > 1); + *desc = smartlist_get(descs, 0); + smartlist_set(descs, 0, NULL); + SMARTLIST_FOREACH(descs, rend_encoded_v2_service_descriptor_t *, d, + rend_encoded_v2_service_descriptor_free(d)); smartlist_free(descs); rend_service_descriptor_free(generated); } |