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

[or-cvs] r12473: backport the fixes for bug 549. (in tor/branches/tor-0_1_2-patches: . src/or)



Author: arma
Date: 2007-11-11 00:36:28 -0500 (Sun, 11 Nov 2007)
New Revision: 12473

Modified:
   tor/branches/tor-0_1_2-patches/ChangeLog
   tor/branches/tor-0_1_2-patches/src/or/dns.c
Log:
backport the fixes for bug 549.


Modified: tor/branches/tor-0_1_2-patches/ChangeLog
===================================================================
--- tor/branches/tor-0_1_2-patches/ChangeLog	2007-11-11 05:33:49 UTC (rev 12472)
+++ tor/branches/tor-0_1_2-patches/ChangeLog	2007-11-11 05:36:28 UTC (rev 12473)
@@ -2,6 +2,8 @@
   o Major bugfixes:
     - When the clock jumps forward a lot, do not allow the bandwidth
       buckets to become negative.  Fixes Bug 544.
+    - Fix a memory leak on exit relays; we were leaking a cached_resolve_t
+      on every successful resolve. Reported by Mike Perry.
 
 
 Changes in version 0.1.2.18 - 2007-10-28

Modified: tor/branches/tor-0_1_2-patches/src/or/dns.c
===================================================================
--- tor/branches/tor-0_1_2-patches/src/or/dns.c	2007-11-11 05:33:49 UTC (rev 12472)
+++ tor/branches/tor-0_1_2-patches/src/or/dns.c	2007-11-11 05:36:28 UTC (rev 12473)
@@ -409,15 +409,15 @@
                 removed ? removed->address : "NULL", (void*)remove);
       }
       tor_assert(removed == resolve);
-      if (resolve->is_reverse)
-        tor_free(resolve->result.hostname);
-      resolve->magic = 0xF0BBF0BB;
-      tor_free(resolve);
     } else {
       /* This should be in state DONE. Make sure it's not in the cache. */
       cached_resolve_t *tmp = HT_FIND(cache_map, &cache_root, resolve);
       tor_assert(tmp != resolve);
     }
+    if (resolve->is_reverse)
+      tor_free(resolve->result.hostname);
+    resolve->magic = 0xF0BBF0BB;
+    tor_free(resolve);
   }
 
   assert_cache_ok();