diff options
Diffstat (limited to 'sal')
-rw-r--r-- | sal/osl/w32/file_dirvol.cxx | 28 | ||||
-rw-r--r-- | sal/osl/w32/file_url.cxx | 2 | ||||
-rw-r--r-- | sal/osl/w32/pipe.cxx | 2 | ||||
-rw-r--r-- | sal/osl/w32/security.cxx | 2 |
4 files changed, 24 insertions, 10 deletions
diff --git a/sal/osl/w32/file_dirvol.cxx b/sal/osl/w32/file_dirvol.cxx index cfdf957ef0de..36a4b5d4013d 100644 --- a/sal/osl/w32/file_dirvol.cxx +++ b/sal/osl/w32/file_dirvol.cxx @@ -345,11 +345,12 @@ static HANDLE WINAPI OpenDirectory( rtl_uString* pPath) } WCHAR* szFileMask = static_cast< WCHAR* >( malloc( sizeof( WCHAR ) * ( nLen + nSuffLen + 1 ) ) ); - + assert(szFileMask); // Don't handle OOM conditions wcscpy( szFileMask, o3tl::toW(rtl_uString_getStr( pPath )) ); wcscat( szFileMask, pSuffix ); pDirectory = static_cast<LPDIRECTORY>(HeapAlloc(GetProcessHeap(), 0, sizeof(DIRECTORY))); + assert(pDirectory); // Don't handle OOM conditions pDirectory->hFind = FindFirstFileW(szFileMask, &pDirectory->aFirstData); if (!IsValidHandle(pDirectory->hFind)) @@ -437,6 +438,7 @@ static oslFileError osl_openLocalRoot( Directory_Impl *pDirImpl; pDirImpl = static_cast<Directory_Impl*>(malloc( sizeof(Directory_Impl))); + assert(pDirImpl); // Don't handle OOM conditions ZeroMemory( pDirImpl, sizeof(Directory_Impl) ); rtl_uString_newFromString( &pDirImpl->m_pDirectoryPath, strSysPath ); @@ -501,6 +503,7 @@ static oslFileError osl_openFileDirectory( *pDirectory = nullptr; Directory_Impl *pDirImpl = static_cast<Directory_Impl*>(malloc(sizeof(Directory_Impl))); + assert(pDirImpl); // Don't handle OOM conditions ZeroMemory( pDirImpl, sizeof(Directory_Impl) ); rtl_uString_newFromString( &pDirImpl->m_pDirectoryPath, strDirectoryPath ); @@ -566,6 +569,7 @@ static oslFileError osl_openNetworkServer( Directory_Impl *pDirImpl; pDirImpl = static_cast<Directory_Impl*>(malloc(sizeof(Directory_Impl))); + assert(pDirImpl); // Don't handle OOM conditions ZeroMemory( pDirImpl, sizeof(Directory_Impl) ); pDirImpl->uType = DIRECTORYTYPE_NETROOT; pDirImpl->hDirectory = hEnum; @@ -1068,18 +1072,24 @@ oslFileError SAL_CALL osl_getDirectoryItem(rtl_uString *strFilePath, oslDirector { DirectoryItem_Impl *pItemImpl = static_cast<DirectoryItem_Impl*>(malloc(sizeof(DirectoryItem_Impl))); + if (!pItemImpl) + error = osl_File_E_NOMEM; - ZeroMemory( pItemImpl, sizeof(DirectoryItem_Impl) ); - osl_acquireDirectoryItem( static_cast<oslDirectoryItem>(pItemImpl) ); + if (osl_File_E_None == error) + { + ZeroMemory(pItemImpl, sizeof(DirectoryItem_Impl)); + osl_acquireDirectoryItem(static_cast<oslDirectoryItem>(pItemImpl)); - CopyMemory( &pItemImpl->FindData, &aFindData, sizeof(WIN32_FIND_DATAW) ); - rtl_uString_newFromString( &pItemImpl->m_pFullPath, strSysFilePath ); + CopyMemory(&pItemImpl->FindData, &aFindData, sizeof(WIN32_FIND_DATAW)); + rtl_uString_newFromString(&pItemImpl->m_pFullPath, strSysFilePath); - // MT: This costs 600ms startup time on fast v60x! - // GetCaseCorrectPathName( pItemImpl->szFullPath, pItemImpl->szFullPath, sizeof(pItemImpl->szFullPath) ); + // MT: This costs 600ms startup time on fast v60x! + // GetCaseCorrectPathName( pItemImpl->szFullPath, pItemImpl->szFullPath, sizeof(pItemImpl->szFullPath) ); + + pItemImpl->uType = DIRECTORYITEM_FILE; + *pItem = pItemImpl; + } - pItemImpl->uType = DIRECTORYITEM_FILE; - *pItem = pItemImpl; FindClose( hFind ); } else diff --git a/sal/osl/w32/file_url.cxx b/sal/osl/w32/file_url.cxx index b096515902ba..c8291c056674 100644 --- a/sal/osl/w32/file_url.cxx +++ b/sal/osl/w32/file_url.cxx @@ -603,7 +603,7 @@ static void osl_encodeURL_( rtl_uString *strURL, rtl_String **pstrEncodedURL ) rtl_uString2String( &strUTF8, rtl_uString_getStr( strURL ), rtl_uString_getLength( strURL ), RTL_TEXTENCODING_UTF8, OUSTRING_TO_OSTRING_CVTFLAGS ); pszEncodedURL = static_cast<sal_Char*>(malloc( (rtl_string_getLength( strUTF8 ) * 3 + 1) * sizeof(sal_Char) )); - + assert(pszEncodedURL); // Don't handle OOM conditions pURLDest = pszEncodedURL; pURLScan = rtl_string_getStr( strUTF8 ); nURLScanLen = rtl_string_getLength( strUTF8 ); diff --git a/sal/osl/w32/pipe.cxx b/sal/osl/w32/pipe.cxx index b128143702a1..f02a8951f3cb 100644 --- a/sal/osl/w32/pipe.cxx +++ b/sal/osl/w32/pipe.cxx @@ -136,12 +136,14 @@ oslPipe SAL_CALL osl_createPipe(rtl_uString *strPipeName, oslPipeOptions Options PSECURITY_DESCRIPTOR pSecDesc; pSecDesc = static_cast< PSECURITY_DESCRIPTOR >(malloc(SECURITY_DESCRIPTOR_MIN_LENGTH)); + assert(pSecDesc); // Don't handle OOM conditions /* add a NULL disc. ACL to the security descriptor */ OSL_VERIFY(InitializeSecurityDescriptor(pSecDesc, SECURITY_DESCRIPTOR_REVISION)); OSL_VERIFY(SetSecurityDescriptorDacl(pSecDesc, TRUE, nullptr, FALSE)); pSecAttr = static_cast< PSECURITY_ATTRIBUTES >(malloc(sizeof(SECURITY_ATTRIBUTES))); + assert(pSecAttr); // Don't handle OOM conditions pSecAttr->nLength = sizeof(SECURITY_ATTRIBUTES); pSecAttr->lpSecurityDescriptor = pSecDesc; pSecAttr->bInheritHandle = TRUE; diff --git a/sal/osl/w32/security.cxx b/sal/osl/w32/security.cxx index aeecf1b8ca63..f7e14e7e32ae 100644 --- a/sal/osl/w32/security.cxx +++ b/sal/osl/w32/security.cxx @@ -19,6 +19,7 @@ #include "system.h" +#include <cassert> #include <osl/security.h> #include <osl/diagnose.h> #include <osl/thread.h> @@ -782,6 +783,7 @@ static bool getUserNameImpl(oslSecurity Security, rtl_uString **strName, bool b WNetGetUserW(nullptr, nullptr, &needed); pNameW = static_cast<sal_Unicode *>(malloc (needed*sizeof(sal_Unicode))); + assert(pNameW); // Don't handle OOM conditions if (WNetGetUserW(nullptr, o3tl::toW(pNameW), &needed) == NO_ERROR) { |