[Libreoffice-commits] .: sal/osl

Caolán McNamara caolan at kemper.freedesktop.org
Fri Jan 6 04:11:46 PST 2012


 sal/osl/unx/file.cxx |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit c11bcb5be5a282864ffc35d2b29d530f07a7e8fd
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jan 6 12:10:45 2012 +0000

    valgrind: error on startup in osl_unmapMappedFile

diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx
index bb31902..4bb30cf 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);
 


More information about the Libreoffice-commits mailing list