From: Jelte Jansen Date: Wed, 3 Oct 2012 14:42:08 +0000 (+0200) Subject: [2275] valgrind fix: store singleton instance in auto_ptr X-Git-Tag: trac2351_base~5^2~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0c38d26f6acc7d156dc6c6871b4fa332e30728ee;p=thirdparty%2Fkea.git [2275] valgrind fix: store singleton instance in auto_ptr --- diff --git a/src/lib/acl/dns.cc b/src/lib/acl/dns.cc index d16ec658d3..d164398283 100644 --- a/src/lib/acl/dns.cc +++ b/src/lib/acl/dns.cc @@ -106,10 +106,10 @@ internal::RequestCheckCreator::create(const string& name, RequestLoader& getRequestLoader() { - static RequestLoader* loader(NULL); - if (loader == NULL) { + static auto_ptr loader(NULL); + if (loader.get() == NULL) { // Creator registration may throw, so we first store the new loader - // in an auto pointer in order to provide the strong exception + // in a second auto pointer in order to provide the strong exception // guarantee. auto_ptr loader_ptr = auto_ptr(new RequestLoader(REJECT)); @@ -129,7 +129,7 @@ getRequestLoader() { new LogicCreator("ALL"))); // From this point there shouldn't be any exception thrown - loader = loader_ptr.release(); + loader.reset(loader_ptr.release()); } return (*loader);