]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
fixed small but possibly relevant memory leak in mtasker on duplicate wait keys
authorBert Hubert <bert.hubert@netherlabs.nl>
Sat, 4 Mar 2006 23:59:30 +0000 (23:59 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Sat, 4 Mar 2006 23:59:30 +0000 (23:59 +0000)
make dnsreplay_mindex compile again

git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@572 d19b8d6e-7fed-0310-83ef-9ca221ded41b

pdns/dnsreplay-mindex.cc
pdns/mtasker.cc
pdns/pdns_recursor.cc

index 4db7479bb83ca13cd8862447314dd40ba0226095..d50182d1576aacec75311a00d25d0083703be9b8 100644 (file)
@@ -44,9 +44,14 @@ What to do with timeouts. We keep around at most 65536 outstanding answers.
 #include "dnspcap.hh"
 #include "sstuff.hh"
 #include "anadns.hh"
+
+// this is needed because boost multi_index also uses 'L', as do we (which is sad enough)
+#undef L
+
 #include <arpa/nameser.h>
 #include <set>
 #include <deque>
+
 #include <boost/format.hpp>
 #include <boost/utility.hpp>
 #include <boost/multi_index_container.hpp>
index 278540186399584ce689b31322da4e85ab4dab66..06d5f21d0de0f4f838bc5f70dbcc532e14c64f69 100644 (file)
@@ -161,14 +161,15 @@ int main()
 
 template<class EventKey, class EventVal>int MTasker<EventKey,EventVal>::waitEvent(const EventKey &key, EventVal *val, unsigned int timeout)
 {
+  if(d_waiters.count(key)) { // there was already an exact same waiter
+    return -1;
+  }
+
   Waiter w;
   w.context=new ucontext_t;
   w.ttd= timeout ? time(0)+timeout : 0;
   w.tid=d_tid;
   
-  if(d_waiters.count(key)) { // there was already an exact same waiter
-    return -1;
-  }
   w.key=key;
 
   d_waiters.insert(w);
index 5f085cc6cf10eddb5f16e83bb68f35b9d7cd43aa..56360cb8380d2e6f4488028be2ca9b3c85b0935f 100644 (file)
@@ -724,8 +724,9 @@ int main(int argc, char **argv)
       
       if(!((counter++)%100)) 
        MT->makeThread(houseKeeping,0,"housekeeping");
-      if(statsWanted)
+      if(statsWanted) {
        doStats();
+      }
 
       Utility::socklen_t addrlen=sizeof(fromaddr);
       int d_len;