diff --git a/ChangeLog b/ChangeLog index 770fcf9eee..4767cfcb97 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,8 @@ Changes in version 0.2.0.24-rc - 2008-04-0? 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. + - Free static hashtables for policy maps and for TLS connections on + shutdown, so they don't look like memory leaks. Bugfix on 0.2.0.x. Changes in version 0.2.0.23-rc - 2008-03-24 diff --git a/doc/TODO.020 b/doc/TODO.020 index 1e9f03ca0f..7b7ff430a4 100644 --- a/doc/TODO.020 +++ b/doc/TODO.020 @@ -5,8 +5,8 @@ description of the patch.) Backport items for 0.2.0: o r14204: start policy refcounts at 1, not 2. o r14205: free authority certs on exit. - - r14212: free static hashtables and log mutex on exit. - - r14214: don't read torrc when all we + o r14212: free static hashtables and log mutex on exit. + - r14214: don't read torrc when all we do is --hash-password - r14329: update last_added_nonpadding for relay cells. Backport for 0.2.0 once better tested: diff --git a/src/common/tortls.c b/src/common/tortls.c index 7ad1507218..708e4c0f79 100644 --- a/src/common/tortls.c +++ b/src/common/tortls.c @@ -314,6 +314,10 @@ tor_tls_free_all(void) tor_tls_context_decref(global_tls_context); global_tls_context = NULL; } + if (!HT_EMPTY(&tlsmap_root)) { + log_warn(LD_MM, "Still have entries in the tlsmap at shutdown."); + } + HT_CLEAR(tlsmap, &tlsmap_root); } /** We need to give OpenSSL a callback to verify certificates. This is diff --git a/src/or/main.c b/src/or/main.c index 2ebd08b947..8357124297 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -1849,13 +1849,15 @@ tor_free_all(int postfork) entry_guards_free_all(); connection_free_all(); buf_shrink_freelists(1); - policies_free_all(); if (!postfork) { config_free_all(); router_free_all(); + policies_free_all(); } free_cell_pool(); - tor_tls_free_all(); + if (!postfork) { + tor_tls_free_all(); + } /* stuff in main.c */ smartlist_free(connection_array); smartlist_free(closeable_connection_lst); diff --git a/src/or/policies.c b/src/or/policies.c index b7bddc6fd8..e28ba3cb48 100644 --- a/src/or/policies.c +++ b/src/or/policies.c @@ -922,5 +922,9 @@ policies_free_all(void) authdir_reject_policy = NULL; addr_policy_list_free(authdir_invalid_policy); authdir_invalid_policy = NULL; + + if (!HT_EMPTY(&policy_root)) + log_warn(LD_MM, "Still had some address policies cached at shutdown."); + HT_CLEAR(policy_map, &policy_root); }