From 3b25ea6d83041c03d06a47fb5e278372181b8a6d Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Sun, 31 Mar 2019 16:45:29 +0300 Subject: tdf#120703 PVS: Silence V575 warnings V575 The potential null pointer is passed into 'foo' function Add asserts to those cases that are related to OOM cases. There's nothing to be done if the assertions fail anyway. Change-Id: I92ac95d44f512aa1948b1552b0e1f6da695a9f92 Reviewed-on: https://gerrit.libreoffice.org/70008 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- setup_native/source/win32/customactions/regactivex/regactivex.cxx | 3 +++ setup_native/source/win32/customactions/sellang/sellang.cxx | 2 ++ setup_native/source/win32/customactions/tools/checkversion.cxx | 2 ++ 3 files changed, 7 insertions(+) (limited to 'setup_native/source') diff --git a/setup_native/source/win32/customactions/regactivex/regactivex.cxx b/setup_native/source/win32/customactions/regactivex/regactivex.cxx index 293a8c8a4111..f7234a4725c8 100644 --- a/setup_native/source/win32/customactions/regactivex/regactivex.cxx +++ b/setup_native/source/win32/customactions/regactivex/regactivex.cxx @@ -23,6 +23,7 @@ #include #include +#include #include #include @@ -66,6 +67,7 @@ static void RegisterActiveXNative( const wchar_t* pActiveXPath, int nMode, BOOL if ( nLen > nRemoveLen ) { wchar_t* pProgramPath = static_cast( malloc( (nLen - nRemoveLen + 1) * sizeof(wchar_t) ) ); + assert(pProgramPath); // Don't handle OOM conditions wcsncpy( pProgramPath, pActiveXPath, nLen - nRemoveLen ); pProgramPath[ nLen - nRemoveLen ] = 0; @@ -102,6 +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( malloc( nbytes ) ); + assert(buff); // Don't handle OOM conditions ZeroMemory( buff, nbytes ); MsiGetPropertyW( hMSI, pPropName, buff, &sz ); *ppValue = buff; diff --git a/setup_native/source/win32/customactions/sellang/sellang.cxx b/setup_native/source/win32/customactions/sellang/sellang.cxx index bde31d03ab76..e82560f4239a 100644 --- a/setup_native/source/win32/customactions/sellang/sellang.cxx +++ b/setup_native/source/win32/customactions/sellang/sellang.cxx @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -44,6 +45,7 @@ static BOOL GetMsiPropA( MSIHANDLE hMSI, const char* pPropName, char** ppValue ) sz++; DWORD nbytes = sz * sizeof( char ); char* buff = static_cast( malloc( nbytes ) ); + assert(buff); // Don't handle OOM conditions ZeroMemory( buff, nbytes ); MsiGetPropertyA( hMSI, pPropName, buff, &sz ); *ppValue = buff; diff --git a/setup_native/source/win32/customactions/tools/checkversion.cxx b/setup_native/source/win32/customactions/tools/checkversion.cxx index ffb7a8aa4216..daf20963673b 100644 --- a/setup_native/source/win32/customactions/tools/checkversion.cxx +++ b/setup_native/source/win32/customactions/tools/checkversion.cxx @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -37,6 +38,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( malloc( nbytes ) ); + assert(buff); // Don't handle OOM conditions ZeroMemory( buff, nbytes ); MsiGetPropertyW( hMSI, pPropName, buff, &sz ); *ppValue = buff; -- cgit