From: Bert Hubert Date: Sat, 4 Mar 2006 23:59:30 +0000 (+0000) Subject: fixed small but possibly relevant memory leak in mtasker on duplicate wait keys X-Git-Tag: pdns-2.9.20~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f9f05db41ef5e157172d4ecabe90f87afa2fab0b;p=thirdparty%2Fpdns.git fixed small but possibly relevant memory leak in mtasker on duplicate wait keys make dnsreplay_mindex compile again git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@572 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- diff --git a/pdns/dnsreplay-mindex.cc b/pdns/dnsreplay-mindex.cc index 4db7479bb8..d50182d157 100644 --- a/pdns/dnsreplay-mindex.cc +++ b/pdns/dnsreplay-mindex.cc @@ -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 #include #include + #include #include #include diff --git a/pdns/mtasker.cc b/pdns/mtasker.cc index 2785401863..06d5f21d0d 100644 --- a/pdns/mtasker.cc +++ b/pdns/mtasker.cc @@ -161,14 +161,15 @@ int main() templateint MTasker::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); diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index 5f085cc6cf..56360cb838 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -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;