[or-cvs] r12506: Fix a small memory leak whenever we decide against using a n (in tor/trunk: . src/or)

arma at seul.org arma at seul.org
Thu Nov 15 11:14:08 UTC 2007


Author: arma
Date: 2007-11-15 06:14:08 -0500 (Thu, 15 Nov 2007)
New Revision: 12506

Modified:
   tor/trunk/ChangeLog
   tor/trunk/src/or/circuitbuild.c
Log:
Fix a small memory leak whenever we decide against using a
newly picked entry guard. Reported by Mike Perry.


Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2007-11-15 10:59:17 UTC (rev 12505)
+++ tor/trunk/ChangeLog	2007-11-15 11:14:08 UTC (rev 12506)
@@ -6,12 +6,15 @@
   o Minor bugfixes:
     - When we're lacking a consensus, don't try to perform rendezvous
       operations.  (Bug spotted by Karsten)
+    - Fix a small memory leak whenever we decide against using a
+      newly picked entry guard. Reported by Mike Perry.
 
   o Minor features:
     - When we negotiate a v2 OR connection (not yet implemented), accept
       RELAY_EARLY cells and turn them into RELAY cells if we've negotiated
       a v1 connection.  Initial code for proposal 110.
 
+
 Changes in version 0.2.0.11-alpha - 2007-11-12
   o Security fixes:
     - Exit policies now reject connections that are addressed to a

Modified: tor/trunk/src/or/circuitbuild.c
===================================================================
--- tor/trunk/src/or/circuitbuild.c	2007-11-15 10:59:17 UTC (rev 12505)
+++ tor/trunk/src/or/circuitbuild.c	2007-11-15 11:14:08 UTC (rev 12506)
@@ -2281,7 +2281,7 @@
                "Removing from the list. %d/%d entry guards usable/new.",
                entry->nickname, buf,
                num_live_entry_guards()-1, smartlist_len(entry_guards)-1);
-      tor_free(entry);
+      entry_guard_free(entry);
       smartlist_del_keeporder(entry_guards, idx);
       log_entry_guards(LOG_INFO);
       changed = 1;
@@ -2291,6 +2291,7 @@
       entry->unreachable_since = entry->last_attempted = now;
       control_event_guard(entry->nickname, entry->identity, "DOWN");
       changed = 1;
+      entry->can_retry = 0; /* We gave it an early chance; no good. */
     } else {
       char tbuf[ISO_TIME_LEN+1];
       format_iso_time(tbuf, entry->unreachable_since);
@@ -2298,9 +2299,8 @@
                 "'%s' (%s).  It has been unreachable since %s.",
                 entry->nickname, buf, tbuf);
       entry->last_attempted = now;
+      entry->can_retry = 0; /* We gave it an early chance; no good. */
     }
-    if (entry)
-      entry->can_retry = 0; /* We gave it an early chance; no good. */
   }
 
   if (first_contact) {



More information about the tor-commits mailing list