summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-04-30 08:29:32 +0100
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-04-30 11:08:26 +0200
commit1a471e674f46699a2787e3ab74353fbe1de5c456 (patch)
treea9758ee71fa73be9e2c713e30faea5498b59bea9
parent26166ad838aa4f8fac933a4d14ef5025911cbecb (diff)
WaE: C6011 Dereferencing NULL pointer warnings from unchecked malloc
Change-Id: I14892e3d0badb4a46b82624b86d78eb9bcb8eed7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166700 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
-rw-r--r--setup_native/source/win32/customactions/regactivex/regactivex.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/setup_native/source/win32/customactions/regactivex/regactivex.cxx b/setup_native/source/win32/customactions/regactivex/regactivex.cxx
index 48b11bd4f452..459887c3820b 100644
--- a/setup_native/source/win32/customactions/regactivex/regactivex.cxx
+++ b/setup_native/source/win32/customactions/regactivex/regactivex.cxx
@@ -67,7 +67,7 @@ static void RegisterActiveXNative( const wchar_t* pActiveXPath, int nMode, bool
if ( nLen > nRemoveLen )
{
wchar_t* pProgramPath = static_cast<wchar_t*>( malloc( (nLen - nRemoveLen + 1) * sizeof(wchar_t) ) );
- assert(pProgramPath); // Don't handle OOM conditions
+ assert(pProgramPath && "Don't handle OOM conditions");
wcsncpy( pProgramPath, pActiveXPath, nLen - nRemoveLen );
pProgramPath[ nLen - nRemoveLen ] = 0;
@@ -104,7 +104,7 @@ static bool GetMsiPropW( MSIHANDLE hMSI, const wchar_t* pPropName, wchar_t** ppV
sz++;
DWORD nbytes = sz * sizeof( wchar_t );
wchar_t* buff = static_cast<wchar_t*>( malloc( nbytes ) );
- assert(buff); // Don't handle OOM conditions
+ assert(buff && "Don't handle OOM conditions");
ZeroMemory( buff, nbytes );
MsiGetPropertyW( hMSI, pPropName, buff, &sz );
*ppValue = buff;
@@ -123,6 +123,7 @@ static bool GetActiveXControlPath( MSIHANDLE hMSI, wchar_t** ppActiveXPath )
{
int nLen = wcslen( pProgPath );
*ppActiveXPath = static_cast<wchar_t*>( malloc( (nLen + 23) * sizeof(wchar_t) ) );
+ assert(*ppActiveXPath && "Don't handle OOM conditions");
wcsncpy( *ppActiveXPath, pProgPath, nLen );
wcsncpy( (*ppActiveXPath) + nLen, L"program\\so_activex.dll", 22 );
(*ppActiveXPath)[nLen+22] = 0;