aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-10-10 11:24:16 -0400
committerNick Mathewson <nickm@torproject.org>2013-10-10 11:24:16 -0400
commitdf4693fed57d0a0026186beaa6bb819b854c5b10 (patch)
tree8e5430bf18658468a661c5e9bb875061ead6dfde /src
parent3d817fa29cb9a0f58dd641aabf7f34301bf5809d (diff)
parent2c7ed0406f04caa1609014f66c08964c8b38d0b9 (diff)
downloadtor-df4693fed57d0a0026186beaa6bb819b854c5b10.tar
tor-df4693fed57d0a0026186beaa6bb819b854c5b10.tar.gz
Merge remote-tracking branch 'origin/maint-0.2.4'
Diffstat (limited to 'src')
-rw-r--r--src/or/routerlist.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 2b894277c..cf9cf87a2 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -241,6 +241,27 @@ get_cert_list(const char *id_digest)
return cl;
}
+/** Release all space held by a cert_list_t */
+static void
+cert_list_free(cert_list_t *cl)
+{
+ if (!cl)
+ return;
+
+ SMARTLIST_FOREACH(cl->certs, authority_cert_t *, cert,
+ authority_cert_free(cert));
+ smartlist_free(cl->certs);
+ dsmap_free(cl->dl_status_map, tor_free_);
+ tor_free(cl);
+}
+
+/** Wrapper for cert_list_free so we can pass it to digestmap_free */
+static void
+cert_list_free_(void *cl)
+{
+ cert_list_free(cl);
+}
+
/** Reload the cached v3 key certificates from the cached-certs file in
* the data directory. Return 0 on success, -1 on failure. */
int
@@ -3284,13 +3305,7 @@ routerlist_free_all(void)
smartlist_free(fallback_dir_servers);
trusted_dir_servers = fallback_dir_servers = NULL;
if (trusted_dir_certs) {
- DIGESTMAP_FOREACH(trusted_dir_certs, key, cert_list_t *, cl) {
- SMARTLIST_FOREACH(cl->certs, authority_cert_t *, cert,
- authority_cert_free(cert));
- smartlist_free(cl->certs);
- tor_free(cl);
- } DIGESTMAP_FOREACH_END;
- digestmap_free(trusted_dir_certs, NULL);
+ digestmap_free(trusted_dir_certs, cert_list_free_);
trusted_dir_certs = NULL;
}
}