diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-01-06 12:10:45 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-01-06 12:11:02 +0000 |
commit | c11bcb5be5a282864ffc35d2b29d530f07a7e8fd (patch) | |
tree | 0b64882afc91538255eca85932115606ebb1984a /sal | |
parent | 608c927c0faac0b1e143cf50ce88003a2aaea73f (diff) |
valgrind: error on startup in osl_unmapMappedFile
Diffstat (limited to 'sal')
-rw-r--r-- | sal/osl/unx/file.cxx | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx index bb319022df56..4bb30cfb6eab 100644 --- a/sal/osl/unx/file.cxx +++ b/sal/osl/unx/file.cxx @@ -1045,13 +1045,16 @@ SAL_CALL osl_closeFile( oslFileHandle Handle ) { FileHandle_Impl* pImpl = static_cast<FileHandle_Impl*>(Handle); + if (pImpl == 0) + return osl_File_E_INVAL; + if (pImpl->m_kind == FileHandle_Impl::KIND_MEM) { delete pImpl; return osl_File_E_None; } - if ((pImpl == 0) || (pImpl->m_fd < 0)) + if (pImpl->m_fd < 0) return osl_File_E_INVAL; (void) pthread_mutex_lock (&(pImpl->m_mutex)); @@ -1239,6 +1242,9 @@ SAL_CALL osl_unmapMappedFile (oslFileHandle Handle, void* pAddr, sal_uInt64 uLen { FileHandle_Impl * pImpl = static_cast<FileHandle_Impl*>(Handle); + if (pImpl == 0) + return osl_File_E_INVAL; + if (pImpl->m_kind == FileHandle_Impl::KIND_FD) return unmapFile (pAddr, uLength); |