summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dns.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/dns.cpp b/src/dns.cpp
index e587cc330..5bdd2a4eb 100644
--- a/src/dns.cpp
+++ b/src/dns.cpp
@@ -557,15 +557,16 @@ void DNSManager::Tick(time_t now)
{
Log(LOG_DEBUG_2) << "Resolver: Purging DNS cache";
- for (std::multimap<Anope::string, DNSRecord *>::iterator it = this->cache.begin(), it_end = this->cache.end(); it != it_end;)
+ for (std::multimap<Anope::string, DNSRecord *>::iterator it = this->cache.begin(), it_next; it != this->cache.end(); it = it_next)
{
Anope::string host = it->first;
DNSRecord *req = it->second;
- ++it;
+ it_next = it;
+ ++it_next;
if (req->created + req->ttl < now)
{
- this->cache.erase(host);
+ this->cache.erase(it);
delete req;
}
}