diff --git a/ChangeLog b/ChangeLog index 95afc349f8..770fcf9eee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,8 @@ Changes in version 0.2.0.24-rc - 2008-04-0? - When opening a logfile fails, tell us why. - Keep address policies from leaking: start their refcount at 1, not 2. Bugfix on 0.2.0.16-alpha. + - Free authority certificates on exit, so they don't look like memory + leaks. Bugfix on 0.2.0.19-alpha. Changes in version 0.2.0.23-rc - 2008-03-24 diff --git a/doc/TODO.020 b/doc/TODO.020 index 4e6d3b7fb1..1e9f03ca0f 100644 --- a/doc/TODO.020 +++ b/doc/TODO.020 @@ -4,7 +4,7 @@ description of the patch.) Backport items for 0.2.0: o r14204: start policy refcounts at 1, not 2. - - r14205: free authority certs on exit. + o r14205: free authority certs on exit. - r14212: free static hashtables and log mutex on exit. - r14214: don't read torrc when all we - r14329: update last_added_nonpadding for relay cells. diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 2210173f80..146b1457c1 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -2628,6 +2628,17 @@ routerlist_free_all(void) smartlist_free(trusted_dir_servers); trusted_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); + trusted_dir_certs = NULL; + } } /** Forget that we have issued any router-related warnings, so that we'll