summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2010-11-09 03:20:50 -0500
committerAdam <Adam@anope.org>2010-11-09 03:20:50 -0500
commitfe6d7913ce3c2fc686691806202d1da6a0969e00 (patch)
tree93c31d9d85b68cc3ae721eb4a47f1c1606fab951
parentdc1252597ace34b5961b94333738b27b657f06de (diff)
Fixed a crash in the DNS engine when using cached results
-rw-r--r--src/dns.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/dns.cpp b/src/dns.cpp
index adedf9e61..0ccd5d9dd 100644
--- a/src/dns.cpp
+++ b/src/dns.cpp
@@ -7,7 +7,7 @@ static inline unsigned short GetRandomID()
return rand();
}
-DNSRequest::DNSRequest(const Anope::string &addr, QueryType qt, bool cache, Module *c) : creator(c), address(addr), QT(qt)
+DNSRequest::DNSRequest(const Anope::string &addr, QueryType qt, bool cache, Module *c) : timeout(NULL), id(0), creator(c), address(addr), QT(qt)
{
if (!DNSEngine)
DNSEngine = new DNSManager();
@@ -52,6 +52,9 @@ DNSRequest::DNSRequest(const Anope::string &addr, QueryType qt, bool cache, Modu
DNSRequest::~DNSRequest()
{
+ /* We never got a chance to fire off a query or create a timer */
+ if (!this->timeout)
+ return;
/* DNSRequest came back, delete the timeout */
if (!this->timeout->done)
{