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

[or-cvs] r12471: a potential solution for bug 549 (tor/trunk/src/or)



Author: arma
Date: 2007-11-10 23:36:31 -0500 (Sat, 10 Nov 2007)
New Revision: 12471

Modified:
   tor/trunk/src/or/dns.c
Log:
a potential solution for bug 549


Modified: tor/trunk/src/or/dns.c
===================================================================
--- tor/trunk/src/or/dns.c	2007-11-11 04:19:11 UTC (rev 12470)
+++ tor/trunk/src/or/dns.c	2007-11-11 04:36:31 UTC (rev 12471)
@@ -377,16 +377,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);
-      /* XXX020 shouldn't we be freeing 'resolve' here? */
     }
+    if (resolve->is_reverse)
+      tor_free(resolve->result.hostname);
+    resolve->magic = 0xF0BBF0BB;
+    tor_free(resolve);
   }
 
   assert_cache_ok();
@@ -708,9 +707,8 @@
         tor_fragile_assert();
     }
     tor_assert(0);
-  } else if (resolve) {
-    log_warn(LD_BUG, "Found Mike's bug. Memory leak here!");
   }
+  tor_assert(!resolve);
   /* not there, need to add it */
   resolve = tor_malloc_zero(sizeof(cached_resolve_t));
   resolve->magic = CACHED_RESOLVE_MAGIC;