From: Bert Hubert Date: Thu, 2 Aug 2007 21:29:10 +0000 (+0000) Subject: plug memory leak on packet building error caused by bogus database information X-Git-Tag: rec-3.1.7.1~162 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8ea10bfc8384a25cc5d7d366b94b0f47ccceecdb;p=pdns plug memory leak on packet building error caused by bogus database information git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@1079 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- diff --git a/pdns/packethandler.cc b/pdns/packethandler.cc index 91ce4690f..ae67b4ea2 100644 --- a/pdns/packethandler.cc +++ b/pdns/packethandler.cc @@ -896,6 +896,7 @@ DNSPacket *PacketHandler::questionOrRecurse(DNSPacket *p, bool *shouldRecurse) sendit:; if(doAdditionalProcessingAndDropAA(p,r)<0) return 0; + r->wrapup(); // needed for inserting in cache if(!noCache) PC.insert(p,r); // in the packet cache @@ -906,6 +907,14 @@ DNSPacket *PacketHandler::questionOrRecurse(DNSPacket *p, bool *shouldRecurse) S.inc("servfail-packets"); S.ringAccount("servfail-queries",p->qdomain); } + catch(exception &e) { + L<replyPacket(); // generate an empty reply packet + r->setRcode(RCode::ServFail); + S.inc("servfail-packets"); + S.ringAccount("servfail-queries",p->qdomain); + } return r; }