summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2018-06-02 17:58:40 +0200
committerLuboš Luňák <l.lunak@collabora.com>2018-06-02 20:36:34 +0200
commit656e5cecbef254c08c871381abc8364a761a6b94 (patch)
tree7c678f06a851ed76878349ae45f2531ad998f26d /sc
parent7667dda435b2671f1d78e967669fa0fe725b5af6 (diff)
fix memory leak in double-checked init
The pointer indeed shouldn't be just a local argument but a reference to the global variable, otherwise just the argument gets set. Change-Id: Ib7060943b089336b409d4861540a861ca2793cde Reviewed-on: https://gerrit.libreoffice.org/55209 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/global.cxx2
1 files changed, 1 insertions, 1 deletions
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index 6e258407653d..bf76a7085758 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -133,7 +133,7 @@ bool ScGlobal::bThreadedGroupCalcInProgress = false;
template< typename Type, typename Function = std::function< Type*() >,
typename Guard = osl::MutexGuard, typename GuardCtor = osl::GetGlobalMutex >
static inline
-Type* doubleCheckedInit( Type* pointer, Function function, GuardCtor guardCtor = osl::GetGlobalMutex())
+Type* doubleCheckedInit( Type*& pointer, Function function, GuardCtor guardCtor = osl::GetGlobalMutex())
{
Type* p = pointer;
if (!p)