Parcourir la source

r19074@catbus: nickm | 2008-03-26 17:08:32 -0400
Start new address policies with refcount of 1, not 2. Backport candidate once tested more.


svn:r14204

Nick Mathewson il y a 17 ans
Parent
commit
944bd3dbed
3 fichiers modifiés avec 8 ajouts et 4 suppressions
  1. 2 0
      ChangeLog
  2. 1 1
      src/or/policies.c
  3. 5 3
      src/or/routerparse.c

+ 2 - 0
ChangeLog

@@ -13,6 +13,8 @@ Changes in version 0.2.1.1-alpha - 2008-??-??
       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

+ 1 - 1
src/or/policies.c

@@ -495,7 +495,7 @@ addr_policy_get_canonical_entry(addr_policy_t *e)
     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);
   }
 

+ 5 - 3
src/or/routerparse.c

@@ -1652,18 +1652,20 @@ authority_cert_parse_from_string(const char *s, const char **end_of_string)
     *end_of_string = eat_whitespace(eos);
   }
   SMARTLIST_FOREACH(tokens, directory_token_t *, t, token_free(t));
-  if (area)
-    memarea_drop_all(area);
   smartlist_free(tokens);
+  if (area) {
+    DUMP_AREA(area, "authority cert");
+    memarea_drop_all(area);
+  }
   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;
 }