diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2019-03-31 16:45:29 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2019-03-31 16:43:44 +0200 |
commit | 3b25ea6d83041c03d06a47fb5e278372181b8a6d (patch) | |
tree | 5be37a4a5959bf1e73217695c1297392d68a11e6 /setup_native | |
parent | bf2f0c913774c90e4c9a65119d0219187bb4498c (diff) |
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 <mike.kaganski@collabora.com>
Diffstat (limited to 'setup_native')
3 files changed, 7 insertions, 0 deletions
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 <windows.h> #include <msiquery.h> +#include <cassert> #include <string.h> #include <malloc.h> @@ -66,6 +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 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<wchar_t*>( 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 <msiquery.h> #include <malloc.h> +#include <cassert> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -44,6 +45,7 @@ static BOOL GetMsiPropA( MSIHANDLE hMSI, const char* pPropName, char** ppValue ) sz++; DWORD nbytes = sz * sizeof( char ); char* buff = static_cast<char*>( 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 <windows.h> #include <msiquery.h> +#include <cassert> #include <string.h> #include <malloc.h> #include <stdio.h> @@ -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<wchar_t*>( malloc( nbytes ) ); + assert(buff); // Don't handle OOM conditions ZeroMemory( buff, nbytes ); MsiGetPropertyW( hMSI, pPropName, buff, &sz ); *ppValue = buff; |