]> granicus.if.org Git - pdns/commitdiff
auth: Fix a leak on 'Backend reported permanent error which prevented lookup' error
authorRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 28 Jun 2019 13:21:12 +0000 (15:21 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 28 Jun 2019 13:21:12 +0000 (15:21 +0200)
pdns/distributor.hh
pdns/packethandler.cc

index ecc1509cd49525ca92f663e1c764e17845039642..9efb928aff986c2abda3fb2b54f42ec040590ca9 100644 (file)
@@ -193,7 +193,7 @@ template<class Answer, class Question, class Backend>void *MultiThreadDistributo
       if(read(us->d_pipes[ournum].first, &QD, sizeof(QD)) != sizeof(QD))
        unixDie("read");
       --us->d_queued;
-      Answer *a
+      Answer *a = nullptr;
 
       if(queuetimeout && QD->Q->d_dt.udiff()>queuetimeout*1000) {
         delete QD->Q;
@@ -267,7 +267,7 @@ retry:
 
 template<class Answer, class Question, class Backend>int SingleThreadDistributor<Answer,Question,Backend>::question(Question* q, callback_t callback)
 {
-  Answer *a;
+  Answer *a = nullptr;
   bool allowRetry=true;
 retry:
   try {
index 7b1176d88a6cade1d795b458298d777a75e2dfa8..fc15f5aad314eff90fca552427419b9e3e071e79 100644 (file)
@@ -1100,7 +1100,7 @@ DNSPacket *PacketHandler::doQuestion(DNSPacket *p)
   DNSName haveAlias;
   uint8_t aliasScopeMask;
 
-  DNSPacket *r=0;
+  DNSPacket *r=nullptr;
   bool noCache=false;
 
 #ifdef HAVE_LUA_RECORDS
@@ -1559,6 +1559,7 @@ DNSPacket *PacketHandler::doQuestion(DNSPacket *p)
   }
   catch(PDNSException &e) {
     g_log<<Logger::Error<<"Backend reported permanent error which prevented lookup ("+e.reason+"), aborting"<<endl;
+    delete r;
     throw; // we WANT to die at this point
   }
   catch(std::exception &e) {