From 464afd4d2ddd06f6ed6c0747da83b8dbb338686a Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Wed, 28 Jun 2017 22:21:06 +0100 Subject: Ensure DNSResolver destructor runs on exit Plugs a noisy but benign memory leak --- src/common/dns_utils.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/common/dns_utils.cpp') diff --git a/src/common/dns_utils.cpp b/src/common/dns_utils.cpp index ab38cbbae..979f34b3e 100644 --- a/src/common/dns_utils.cpp +++ b/src/common/dns_utils.cpp @@ -307,12 +307,8 @@ DNSResolver& DNSResolver::instance() { boost::lock_guard lock(instance_lock); - static DNSResolver* staticInstance = NULL; - if (staticInstance == NULL) - { - staticInstance = new DNSResolver(); - } - return *staticInstance; + static DNSResolver staticInstance; + return staticInstance; } DNSResolver DNSResolver::create() -- cgit v1.2.3