[or-cvs] r14204: Start new address policies with refcount of 1, not 2. Backpo (in tor/trunk: . src/or)

nickm at seul.org nickm at seul.org
Wed Mar 26 21:08:39 UTC 2008


Author: nickm
Date: 2008-03-26 17:08:39 -0400 (Wed, 26 Mar 2008)
New Revision: 14204

Modified:
   tor/trunk/
   tor/trunk/ChangeLog
   tor/trunk/src/or/policies.c
   tor/trunk/src/or/routerparse.c
Log:
 r19074 at catbus:  nickm | 2008-03-26 17:08:32 -0400
 Start new address policies with refcount of 1, not 2.  Backport candidate once tested more.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r19074] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2008-03-26 18:59:45 UTC (rev 14203)
+++ tor/trunk/ChangeLog	2008-03-26 21:08:39 UTC (rev 14204)
@@ -13,6 +13,8 @@
       Fixes the other part of bug 617.  Bugfix on 0.2.0.1-alpha.
     - Initialize log mutex before initializing dmalloc.  Otherwise,
       running with dmalloc would crash. Bugfix on 0.2.0.x-alpha.
+    - Keep address policies from leaking: start their refcount at 1, not
+      2. Bugfix on 0.2.0.16-alpha.
 
   o Minor features:
     - Allow separate log levels to be configured for different logging

Modified: tor/trunk/src/or/policies.c
===================================================================
--- tor/trunk/src/or/policies.c	2008-03-26 18:59:45 UTC (rev 14203)
+++ tor/trunk/src/or/policies.c	2008-03-26 21:08:39 UTC (rev 14204)
@@ -495,7 +495,7 @@
     found = tor_malloc_zero(sizeof(policy_map_ent_t));
     found->policy = tor_memdup(e, sizeof(addr_policy_t));
     found->policy->is_canonical = 1;
-    found->policy->refcnt = 1;
+    found->policy->refcnt = 0;
     HT_INSERT(policy_map, &policy_root, found);
   }
 

Modified: tor/trunk/src/or/routerparse.c
===================================================================
--- tor/trunk/src/or/routerparse.c	2008-03-26 18:59:45 UTC (rev 14203)
+++ tor/trunk/src/or/routerparse.c	2008-03-26 21:08:39 UTC (rev 14204)
@@ -1652,18 +1652,20 @@
     *end_of_string = eat_whitespace(eos);
   }
   SMARTLIST_FOREACH(tokens, directory_token_t *, t, token_free(t));
-  if (area)
+  smartlist_free(tokens);
+  if (area) {
+    DUMP_AREA(area, "authority cert");
     memarea_drop_all(area);
-  smartlist_free(tokens);
+  }
   return cert;
  err:
   authority_cert_free(cert);
   SMARTLIST_FOREACH(tokens, directory_token_t *, t, token_free(t));
+  smartlist_free(tokens);
   if (area) {
     DUMP_AREA(area, "authority cert");
     memarea_drop_all(area);
   }
-  smartlist_free(tokens);
   return NULL;
 }
 



More information about the tor-commits mailing list