diff options
author | Riccardo Spagni <ric@spagni.net> | 2017-08-07 14:46:26 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2017-08-07 14:46:26 +0200 |
commit | 159a6e96690dfc4f7ff92aa7628ac19a704bbc5f (patch) | |
tree | e8620845025d2a99e87bf3310dda92023aca36ad | |
parent | Merge pull request #2159 (diff) | |
parent | Ensure DNSResolver destructor runs on exit (diff) | |
download | monero-159a6e96690dfc4f7ff92aa7628ac19a704bbc5f.tar.xz |
Merge pull request #2132
464afd4d Ensure DNSResolver destructor runs on exit (Howard Chu)
-rw-r--r-- | src/common/dns_utils.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
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<boost::mutex> lock(instance_lock); - static DNSResolver* staticInstance = NULL; - if (staticInstance == NULL) - { - staticInstance = new DNSResolver(); - } - return *staticInstance; + static DNSResolver staticInstance; + return staticInstance; } DNSResolver DNSResolver::create() |