diff options
author | Nick Mathewson <nickm@torproject.org> | 2005-02-10 23:18:39 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2005-02-10 23:18:39 +0000 |
commit | 60f234f42b63ed6a5208c70bbc4c32e532cc903d (patch) | |
tree | aaa4aa5ea631dafadb38afd28c3030a4b54f20c7 /src/or/dirserv.c | |
parent | df41b20e90c5f817b0c8c7ba913cdadea3c671fe (diff) | |
download | tor-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.c | 28 |
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)); +} |