]> granicus.if.org Git - pdns/commitdiff
Rec: Fix 2 use-after-free bugs
authorPieter Lexis <pieter.lexis@powerdns.com>
Wed, 24 Jan 2018 09:08:36 +0000 (10:08 +0100)
committerPieter Lexis <pieter.lexis@powerdns.com>
Wed, 24 Jan 2018 09:24:14 +0000 (10:24 +0100)
Fix CID 1385373.

pdns/pdns_recursor.cc

index 1929b165a1b4e0d5015da9cc321c76ec569caa21..c2b916be69e94938622e1cb7fa1dbb9e63b76c63 100644 (file)
@@ -1589,15 +1589,15 @@ static void handleRunningTCPQuestion(int fd, FDMultiplexer::funcparam_t& var)
       }
 #endif
       if(dc->d_mdp.d_header.qr) {
-        delete dc;
         g_stats.ignoredCount++;
         L<<Logger::Error<<"Ignoring answer from TCP client "<< dc->getRemote() <<" on server socket!"<<endl;
+        delete dc;
         return;
       }
       if(dc->d_mdp.d_header.opcode) {
-        delete dc;
         g_stats.ignoredCount++;
         L<<Logger::Error<<"Ignoring non-query opcode from TCP client "<< dc->getRemote() <<" on server socket!"<<endl;
+        delete dc;
         return;
       }
       else {