[Libreoffice-commits] .: 3 commits - lotuswordpro/source

David Tardon dtardon at kemper.freedesktop.org
Tue Apr 26 03:58:33 PDT 2011


 lotuswordpro/source/filter/bencont.cxx   |    7 +++++++
 lotuswordpro/source/filter/lwpgrfobj.cxx |   15 +++++++++++----
 lotuswordpro/source/filter/tocread.hxx   |    2 +-
 3 files changed, 19 insertions(+), 5 deletions(-)

New commits:
commit 409910d3bf902a138ed7d944b4f9dba3f0003287
Author: David Tardon <dtardon at redhat.com>
Date:   Tue Apr 26 12:56:44 2011 +0200

    do not leak memory

diff --git a/lotuswordpro/source/filter/lwpgrfobj.cxx b/lotuswordpro/source/filter/lwpgrfobj.cxx
index 72503aa..ede43b2 100644
--- a/lotuswordpro/source/filter/lwpgrfobj.cxx
+++ b/lotuswordpro/source/filter/lwpgrfobj.cxx
@@ -63,6 +63,9 @@
  *  For LWP filter architecture prototype
 */
 #include <stdio.h>
+
+#include <boost/scoped_ptr.hpp>
+
 #include "lwp9reader.hxx"
 #include "lwpgrfobj.hxx"
 #include "lwpsdwfileloader.hxx"
@@ -435,10 +438,14 @@ sal_uInt32 LwpGraphicObject::GetRawGrafData(sal_uInt8*& pGrafData)
     // if small file, use the compressed stream for BENTO
     LwpSvStream* pStream = m_pStrm->GetCompressedStream() ?  m_pStrm->GetCompressedStream(): m_pStrm;
 
-    OpenStormBento::LtcBenContainer* pBentoContainer;
-    sal_uLong ulRet = OpenStormBento::BenOpenContainer(pStream, &pBentoContainer);
-    if (ulRet != OpenStormBento::BenErr_OK)
-        return 0;
+    boost::scoped_ptr<OpenStormBento::LtcBenContainer> pBentoContainer;
+    {
+        OpenStormBento::LtcBenContainer* pTmp(0);
+        sal_uLong ulRet = OpenStormBento::BenOpenContainer(pStream, &pTmp);
+        pBentoContainer.reset(pTmp);
+        if (ulRet != OpenStormBento::BenErr_OK)
+            return 0;
+    }
 
     SvStream* pGrafStream = NULL;
 
commit 8a5ad85c2970e27349414576c71688b29a354121
Author: David Tardon <dtardon at redhat.com>
Date:   Tue Apr 26 12:23:43 2011 +0200

    return early if no stream has been found

diff --git a/lotuswordpro/source/filter/bencont.cxx b/lotuswordpro/source/filter/bencont.cxx
index 06c7f18..4d19731 100644
--- a/lotuswordpro/source/filter/bencont.cxx
+++ b/lotuswordpro/source/filter/bencont.cxx
@@ -510,6 +510,13 @@ BenError LtcBenContainer::CreateGraphicStream(SvStream * &pStream, const char *p
     }
 
     OSL_ENSURE(nLen > 0, "expected a non-0 length");
+    // the 'D' stream is NULL or it has invalid length
+    if (nLen <= 0)
+    {
+        pStream = NULL;
+        return BenErr_NamedObjectError;
+    }
+
     char * pBuf = new char[nLen];
     assert(pBuf != NULL);
     char * pPointer = pBuf;
commit 3ba0441cab9235dceaa91d8818b984d9882a038e
Author: David Tardon <dtardon at redhat.com>
Date:   Tue Apr 26 12:20:54 2011 +0200

    fix operator delete mismatch

diff --git a/lotuswordpro/source/filter/tocread.hxx b/lotuswordpro/source/filter/tocread.hxx
index 7a1d509..e0b68f3 100644
--- a/lotuswordpro/source/filter/tocread.hxx
+++ b/lotuswordpro/source/filter/tocread.hxx
@@ -63,7 +63,7 @@ class CBenTOCReader
 public: // Methods
     CBenTOCReader(pLtcBenContainer pContainer)
       { cpContainer = pContainer; cpTOC = NULL; cCurr = 0; }
-    ~CBenTOCReader() { delete cpTOC; }
+    ~CBenTOCReader() { delete[] cpTOC; }
     BenError ReadLabelAndTOC();
 
 private: // Methods


More information about the Libreoffice-commits mailing list