[Libreoffice-commits] core.git: 5 commits - filter/source package/source sc/source sd/source shell/source

Caolán McNamara caolanm at redhat.com
Wed Mar 11 07:09:07 PDT 2015


 filter/source/graphicfilter/icgm/bitmap.hxx     |    3 +--
 filter/source/graphicfilter/ios2met/ios2met.cxx |    3 +--
 package/source/xstor/owriteablestream.cxx       |    3 +--
 sc/source/ui/app/inputhdl.cxx                   |    5 ++---
 sd/source/ui/presenter/PresenterTextView.cxx    |    2 +-
 sd/source/ui/unoidl/unocpres.cxx                |   15 ++++++---------
 shell/source/win32/zipfile/zipfile.cxx          |    3 +++
 7 files changed, 15 insertions(+), 19 deletions(-)

New commits:
commit 58a48aceb289d4d9ccef4f8652d2a41a567e23e9
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 11 10:22:11 2015 +0000

    V595: pointer was utilized before it was verified against nullptr
    
    Change-Id: I271e045ed2f80e648d620f26cd60215f7f806bd1

diff --git a/sd/source/ui/unoidl/unocpres.cxx b/sd/source/ui/unoidl/unocpres.cxx
index c8f1c76..0d182b3 100644
--- a/sd/source/ui/unoidl/unocpres.cxx
+++ b/sd/source/ui/unoidl/unocpres.cxx
@@ -196,19 +196,16 @@ uno::Any SAL_CALL SdXCustomPresentation::getByIndex( sal_Int32 Index )
     if( bDisposing )
         throw lang::DisposedException();
 
-    if( Index < 0 || Index >= (sal_Int32)mpSdCustomShow->PagesVector().size() )
+    if (Index < 0 || !mpSdCustomShow || Index >= (sal_Int32)mpSdCustomShow->PagesVector().size())
         throw lang::IndexOutOfBoundsException();
 
     uno::Any aAny;
-    if(mpSdCustomShow )
-    {
-        SdrPage* pPage = (SdrPage*)mpSdCustomShow->PagesVector()[Index];
+    SdrPage* pPage = (SdrPage*)mpSdCustomShow->PagesVector()[Index];
 
-        if( pPage )
-        {
-            uno::Reference< drawing::XDrawPage > xRef( pPage->getUnoPage(), uno::UNO_QUERY );
-            aAny <<= xRef;
-        }
+    if( pPage )
+    {
+        uno::Reference< drawing::XDrawPage > xRef( pPage->getUnoPage(), uno::UNO_QUERY );
+        aAny <<= xRef;
     }
 
     return aAny;
commit dc23633610a80dcbd978c8c368d7520f0436227f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 11 10:20:05 2015 +0000

    consistently check here
    
    Change-Id: I38f0e3d606d80b717b27a105ebe72b96f3eba50b

diff --git a/sd/source/ui/presenter/PresenterTextView.cxx b/sd/source/ui/presenter/PresenterTextView.cxx
index 4f2e6ca..817ad55 100644
--- a/sd/source/ui/presenter/PresenterTextView.cxx
+++ b/sd/source/ui/presenter/PresenterTextView.cxx
@@ -521,7 +521,7 @@ void PresenterTextView::Implementation::CheckTop (void)
 {
     DBG_ASSERT(mpEditEngine!=NULL, "EditEngine missing");
 
-    if (mnTotalHeight < 0)
+    if (mpEditEngine!=NULL && mnTotalHeight < 0)
         mnTotalHeight = mpEditEngine->GetTextHeight();
     if (mpEditEngine!=NULL && mnTop >= mnTotalHeight)
         mnTop = mnTotalHeight - mpEditEngine->GetLineHeight(0,0);
commit 5448d8ed38c0e13b6df83294689bcabe9f4dcb20
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 11 10:17:30 2015 +0000

    surely this check should preceed deref of pActiveViewSh
    
    Change-Id: Iaed1dafbae75fa61b15349aedda50a7b2d895719

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index eef56d0..74c6222 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -197,13 +197,12 @@ void removeChars(OUString& rStr, sal_Unicode c)
 void ScInputHandler::InitRangeFinder( const OUString& rFormula )
 {
     DeleteRangeFinder();
+    if ( !pActiveViewSh || !SC_MOD()->GetInputOptions().GetRangeFinder() )
+        return;
     ScDocShell* pDocSh = pActiveViewSh->GetViewData().GetDocShell();
     ScDocument& rDoc = pDocSh->GetDocument();
     const sal_Unicode cSheetSep = lcl_getSheetSeparator(&rDoc);
 
-    if ( !pActiveViewSh || !SC_MOD()->GetInputOptions().GetRangeFinder() )
-        return;
-
     OUString aDelimiters = ScEditUtil::ModifyDelimiters(" !\"");
         // delimiters (in addition to ScEditUtil): only characters that are
         // allowed in formulas next to references and the quotation mark (so
commit 252a73ff22a68909b641efb7e8cf833d7f62f8fc
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 11 10:07:00 2015 +0000

    redundant check
    
    Change-Id: Id6b72a1a3133e47a07ee274f4082dde0e7032894

diff --git a/filter/source/graphicfilter/icgm/bitmap.hxx b/filter/source/graphicfilter/icgm/bitmap.hxx
index 9db74c9..3b6a80d 100644
--- a/filter/source/graphicfilter/icgm/bitmap.hxx
+++ b/filter/source/graphicfilter/icgm/bitmap.hxx
@@ -67,8 +67,7 @@ class CGMBitmapDescriptor
         {
             if ( mpAcc )
                 mpBitmap->ReleaseAccess( mpAcc );
-            if ( mpBitmap )
-                delete mpBitmap;
+            delete mpBitmap;
         };
 };
 
diff --git a/filter/source/graphicfilter/ios2met/ios2met.cxx b/filter/source/graphicfilter/ios2met/ios2met.cxx
index 214e655..e72a9d6 100644
--- a/filter/source/graphicfilter/ios2met/ios2met.cxx
+++ b/filter/source/graphicfilter/ios2met/ios2met.cxx
@@ -730,7 +730,6 @@ void OS2METReader::SetRasterOp(RasterOp eROP)
     if (pVirDev->GetRasterOp()!=eROP) pVirDev->SetRasterOp(eROP);
 }
 
-
 void OS2METReader::SetPalette0RGB(sal_uInt16 nIndex, sal_uLong nCol)
 {
     if (pPaletteStack==NULL) {
@@ -751,7 +750,7 @@ void OS2METReader::SetPalette0RGB(sal_uInt16 nIndex, sal_uLong nCol)
             else if (i==0) pPaletteStack->p0RGB[i]=0x00ffffff;
             else pPaletteStack->p0RGB[i]=0;
         }
-        if (pOld0RGB!=NULL) delete[] pOld0RGB;
+        delete[] pOld0RGB;
     }
     pPaletteStack->p0RGB[nIndex]=nCol;
 }
diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx
index 00b8d58..31a99df 100644
--- a/package/source/xstor/owriteablestream.cxx
+++ b/package/source/xstor/owriteablestream.cxx
@@ -1731,8 +1731,7 @@ OWriteStream::~OWriteStream()
     if ( m_pData && m_pData->m_pTypeCollection )
         delete m_pData->m_pTypeCollection;
 
-    if ( m_pData )
-        delete m_pData;
+    delete m_pData;
 }
 
 void OWriteStream::DeInit()
commit 3aebfbc2996beb171aa3badc1e757ddb0514de45
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 11 10:05:07 2015 +0000

    leak on short read
    
    Change-Id: I5da7ec2992f9f0b20aa075ee33d0b882cdf91901

diff --git a/shell/source/win32/zipfile/zipfile.cxx b/shell/source/win32/zipfile/zipfile.cxx
index ac9f9a0..a7708dc 100644
--- a/shell/source/win32/zipfile/zipfile.cxx
+++ b/shell/source/win32/zipfile/zipfile.cxx
@@ -136,7 +136,10 @@ static std::string readString(StreamInterface *stream, unsigned long size)
     unsigned char *tmp = new unsigned char[size];
     unsigned long numBytesRead = stream->sread(tmp, size);
     if (numBytesRead != size)
+    {
+        delete [] tmp;
         throw IOException(-1);
+    }
 
     std::string aStr((char *)tmp, size);
     delete [] tmp;


More information about the Libreoffice-commits mailing list