From: Amos Jeffries Date: Mon, 28 Mar 2016 22:14:41 +0000 (+1300) Subject: Fix MemPools::GetInstance() potential destruct sequence X-Git-Tag: SQUID_4_0_8~7^2~8 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=30697270842d60db30cb0cca8d9647b813ddb305;p=thirdparty%2Fsquid.git Fix MemPools::GetInstance() potential destruct sequence --- diff --git a/src/mem/Pool.cc b/src/mem/Pool.cc index b81d561532..4db5fe7841 100644 --- a/src/mem/Pool.cc +++ b/src/mem/Pool.cc @@ -32,8 +32,11 @@ MemPools::GetInstance() /* Must use this idiom, as we can be double-initialised * if we are called during static initialisations. */ - static MemPools Instance; - return Instance; + static MemPools *Instance = nullptr; + if (!Instance) { + Instance = new MemPools; + } + return *Instance; } MemPoolIterator *