sc/source/core/data/global.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 656e5cecbef254c08c871381abc8364a761a6b94
Author: Luboš Luňák <l.lu...@collabora.com>
Date:   Sat Jun 2 17:58:40 2018 +0200

    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 <c...@libreoffice.org>
    Reviewed-by: Luboš Luňák <l.lu...@collabora.com>

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)
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to