summaryrefslogtreecommitdiff
path: root/src/or/dirserv.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2005-02-10 23:18:39 +0000
committerNick Mathewson <nickm@torproject.org>2005-02-10 23:18:39 +0000
commit60f234f42b63ed6a5208c70bbc4c32e532cc903d (patch)
treeaaa4aa5ea631dafadb38afd28c3030a4b54f20c7 /src/or/dirserv.c
parentdf41b20e90c5f817b0c8c7ba913cdadea3c671fe (diff)
downloadtor-60f234f42b63ed6a5208c70bbc4c32e532cc903d.tar.gz
tor-60f234f42b63ed6a5208c70bbc4c32e532cc903d.zip
Add more functions to free things to help dmalloc allong.
svn:r3613
Diffstat (limited to 'src/or/dirserv.c')
-rw-r--r--src/or/dirserv.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index 610cbf5e37..dac5105ab5 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -998,3 +998,31 @@ size_t dirserv_get_runningrouters(const char **rr, int compress)
return compress ? the_runningrouters_z_len : the_runningrouters_len;
}
+void
+dirserv_free_all(void)
+{
+ if (fingerprint_list) {
+ SMARTLIST_FOREACH(fingerprint_list, fingerprint_entry_t*, fp,
+ { tor_free(fp->nickname);
+ tor_free(fp->fingerprint);
+ tor_free(fp); });
+ smartlist_free(fingerprint_list);
+ fingerprint_list = NULL;
+ }
+ if (descriptor_list) {
+ SMARTLIST_FOREACH(descriptor_list, descriptor_entry_t*, d,
+ free_descriptor_entry(d));
+ smartlist_free(descriptor_list);
+ descriptor_list = NULL;
+ }
+ tor_free(the_directory);
+ tor_free(the_directory_z);
+ the_directory_len = 0;
+ the_directory_z_len = 0;
+ tor_free(cached_directory.dir);
+ tor_free(cached_directory.dir_z);
+ tor_free(cached_runningrouters.dir);
+ tor_free(cached_runningrouters.dir_z);
+ memset(&cached_directory, 0, sizeof(cached_directory));
+ memset(&cached_runningrouters, 0, sizeof(cached_runningrouters));
+}