[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r14333: Backport r14212: Free some static hashtables and the log mut (in tor/branches/tor-0_2_0-patches: . doc src/common src/or)



Author: nickm
Date: 2008-04-09 14:24:55 -0400 (Wed, 09 Apr 2008)
New Revision: 14333

Modified:
   tor/branches/tor-0_2_0-patches/
   tor/branches/tor-0_2_0-patches/ChangeLog
   tor/branches/tor-0_2_0-patches/doc/TODO.020
   tor/branches/tor-0_2_0-patches/src/common/tortls.c
   tor/branches/tor-0_2_0-patches/src/or/main.c
   tor/branches/tor-0_2_0-patches/src/or/policies.c
Log:
 r19269@catbus:  nickm | 2008-04-09 14:24:36 -0400
 Backport r14212: Free some static hashtables and the log mutex on exit.



Property changes on: tor/branches/tor-0_2_0-patches
___________________________________________________________________
 svk:merge ticket from /tor/020 [r19269] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/branches/tor-0_2_0-patches/ChangeLog
===================================================================
--- tor/branches/tor-0_2_0-patches/ChangeLog	2008-04-09 18:24:50 UTC (rev 14332)
+++ tor/branches/tor-0_2_0-patches/ChangeLog	2008-04-09 18:24:55 UTC (rev 14333)
@@ -13,6 +13,8 @@
       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

Modified: tor/branches/tor-0_2_0-patches/doc/TODO.020
===================================================================
--- tor/branches/tor-0_2_0-patches/doc/TODO.020	2008-04-09 18:24:50 UTC (rev 14332)
+++ tor/branches/tor-0_2_0-patches/doc/TODO.020	2008-04-09 18:24:55 UTC (rev 14333)
@@ -5,8 +5,8 @@
 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:

Modified: tor/branches/tor-0_2_0-patches/src/common/tortls.c
===================================================================
--- tor/branches/tor-0_2_0-patches/src/common/tortls.c	2008-04-09 18:24:50 UTC (rev 14332)
+++ tor/branches/tor-0_2_0-patches/src/common/tortls.c	2008-04-09 18:24:55 UTC (rev 14333)
@@ -314,6 +314,10 @@
     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

Modified: tor/branches/tor-0_2_0-patches/src/or/main.c
===================================================================
--- tor/branches/tor-0_2_0-patches/src/or/main.c	2008-04-09 18:24:50 UTC (rev 14332)
+++ tor/branches/tor-0_2_0-patches/src/or/main.c	2008-04-09 18:24:55 UTC (rev 14333)
@@ -1849,13 +1849,15 @@
   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);

Modified: tor/branches/tor-0_2_0-patches/src/or/policies.c
===================================================================
--- tor/branches/tor-0_2_0-patches/src/or/policies.c	2008-04-09 18:24:50 UTC (rev 14332)
+++ tor/branches/tor-0_2_0-patches/src/or/policies.c	2008-04-09 18:24:55 UTC (rev 14333)
@@ -922,5 +922,9 @@
   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);
 }