summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-10-21 10:54:07 -0400
committerNick Mathewson <nickm@torproject.org>2015-10-21 10:54:07 -0400
commit8b01849f3bce1beaf2f08f2c0b94feabda0f5978 (patch)
treed78af3b7fbc64e5732ebc9ef246a89cb939e8a74
parenta5e873ff29d066532322a6946c2bc4d034be8c2d (diff)
downloadtor-8b01849f3bce1beaf2f08f2c0b94feabda0f5978.tar.gz
tor-8b01849f3bce1beaf2f08f2c0b94feabda0f5978.zip
Yet more memory leaks in the rendcache tests
-rw-r--r--src/or/rendcache.c2
-rw-r--r--src/or/rendcache.h2
-rw-r--r--src/test/test_rendcache.c8
3 files changed, 10 insertions, 2 deletions
diff --git a/src/or/rendcache.c b/src/or/rendcache.c
index 82c0336fa1..deb2fea4de 100644
--- a/src/or/rendcache.c
+++ b/src/or/rendcache.c
@@ -157,7 +157,7 @@ rend_cache_failure_entry_free(rend_cache_failure_t *entry)
/** Helper: deallocate a rend_cache_failure_t. (Used with strmap_free(),
* which requires a function pointer whose argument is void*). */
-static void
+STATIC void
rend_cache_failure_entry_free_(void *entry)
{
rend_cache_failure_entry_free(entry);
diff --git a/src/or/rendcache.h b/src/or/rendcache.h
index a0cb68e08a..decb040ee7 100644
--- a/src/or/rendcache.h
+++ b/src/or/rendcache.h
@@ -107,6 +107,8 @@ STATIC void cache_failure_intro_add(const uint8_t *identity,
rend_intro_point_failure_t failure);
STATIC void validate_intro_point_failure(const rend_service_descriptor_t *desc,
const char *service_id);
+
+STATIC void rend_cache_failure_entry_free_(void *entry);
#endif
#endif /* TOR_RENDCACHE_H */
diff --git a/src/test/test_rendcache.c b/src/test/test_rendcache.c
index 5574d3d70b..a1c456cd00 100644
--- a/src/test/test_rendcache.c
+++ b/src/test/test_rendcache.c
@@ -439,6 +439,8 @@ test_rend_cache_lookup_v2_desc_as_dir(void *data)
NS_UNMOCK(hid_serv_responsible_for_desc_id);
tor_free(mock_routerinfo);
rend_cache_free_all();
+ rend_encoded_v2_service_descriptor_free(desc_holder);
+ tor_free(service_id);
}
#undef NS_SUBMODULE
@@ -594,6 +596,8 @@ test_rend_cache_store_v2_desc_as_dir_with_different_time(void *data)
SMARTLIST_FOREACH(descs, rend_encoded_v2_service_descriptor_t *, d,
rend_encoded_v2_service_descriptor_free(d));
smartlist_free(descs);
+ rend_encoded_v2_service_descriptor_free(desc_holder_newer);
+ rend_encoded_v2_service_descriptor_free(desc_holder_older);
}
static void
@@ -1026,6 +1030,7 @@ test_rend_cache_purge(void *data)
tt_int_op(strmap_size(rend_cache), OP_EQ, 0);
// Deals with existing rend_cache
+ rend_cache_free_all();
rend_cache_init();
our_rend_cache = rend_cache;
@@ -1229,6 +1234,7 @@ test_rend_cache_failure_purge(void *data)
(void)data;
// Handles a null failure cache
+ strmap_free(rend_cache_failure, rend_cache_failure_entry_free_);
rend_cache_failure = NULL;
rend_cache_failure_purge();
@@ -1236,7 +1242,7 @@ test_rend_cache_failure_purge(void *data)
tt_int_op(strmap_size(rend_cache_failure), OP_EQ, 0);
done:
- (void)0;
+ rend_cache_free_all();
}
static void