aboutsummaryrefslogtreecommitdiff
path: root/src/or/rendcommon.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-09-09 20:43:31 +0000
committerNick Mathewson <nickm@torproject.org>2008-09-09 20:43:31 +0000
commitf95d7c189bb89474c57dc9b60832df70fe57760f (patch)
treed000c451f9ec0ef25217dcd6b75463182087d19d /src/or/rendcommon.c
parent6c432a5565183b705569310a34b4da54b1bf98d4 (diff)
downloadtor-f95d7c189bb89474c57dc9b60832df70fe57760f.tar.gz
tor-f95d7c189bb89474c57dc9b60832df70fe57760f.zip
Refactor unit test macros and tor_free_all() logic a bit so as to make it easier to free memory on failing tests, in order to suppress scanner warnings and to make dmalloc() usable with tests.
svn:r16816
Diffstat (limited to 'src/or/rendcommon.c')
-rw-r--r--src/or/rendcommon.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c
index 44cbc1b534..49a21f63ae 100644
--- a/src/or/rendcommon.c
+++ b/src/or/rendcommon.c
@@ -837,8 +837,10 @@ _rend_cache_entry_free(void *p)
void
rend_cache_free_all(void)
{
- strmap_free(rend_cache, _rend_cache_entry_free);
- digestmap_free(rend_cache_v2_dir, _rend_cache_entry_free);
+ if (rend_cache)
+ strmap_free(rend_cache, _rend_cache_entry_free);
+ if (rend_cache_v2_dir)
+ digestmap_free(rend_cache_v2_dir, _rend_cache_entry_free);
rend_cache = NULL;
rend_cache_v2_dir = NULL;
}