[Libreoffice-commits] core.git: lotuswordpro/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Aug 15 13:00:17 UTC 2018


 lotuswordpro/source/filter/lwpgrfobj.cxx |   25 ++++++++++---------------
 1 file changed, 10 insertions(+), 15 deletions(-)

New commits:
commit aa7c6cccd896f4ad7357dc819c668983ffc979e6
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Aug 15 11:44:05 2018 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Aug 15 14:59:50 2018 +0200

    ofz#9910 Direct-leak
    
    Change-Id: I14e5fbf8e572e9ea1fd8779434fd46ed43caac2c
    Reviewed-on: https://gerrit.libreoffice.org/59069
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/lotuswordpro/source/filter/lwpgrfobj.cxx b/lotuswordpro/source/filter/lwpgrfobj.cxx
index c732b611a0f1..26b3b8a52be5 100644
--- a/lotuswordpro/source/filter/lwpgrfobj.cxx
+++ b/lotuswordpro/source/filter/lwpgrfobj.cxx
@@ -112,7 +112,6 @@ void LwpGraphicObject::Read()
         m_sDataFormat[strsize] = '\0';
     }
     sal_uInt32 nServerContextSize = m_pObjStrm->QuickReaduInt32();
-    unsigned char *pServerContext = nullptr;
     if (nServerContextSize > 0)
     {
         sal_uInt16 nMaxPossibleSize = m_pObjStrm->remainingSize();
@@ -123,16 +122,16 @@ void LwpGraphicObject::Read()
             nServerContextSize = nMaxPossibleSize;
         }
 
-        pServerContext = new unsigned char[nServerContextSize];
-        m_pObjStrm->QuickRead(pServerContext, static_cast<sal_uInt16>(nServerContextSize));
+        std::vector<unsigned char> aServerContext(nServerContextSize);
+        m_pObjStrm->QuickRead(aServerContext.data(), static_cast<sal_uInt16>(nServerContextSize));
         if (nServerContextSize > 44)
         {
-            m_aIPData.nBrightness = pServerContext[14];
-            m_aIPData.nContrast = pServerContext[19];
-            m_aIPData.nEdgeEnchancement = pServerContext[24];
-            m_aIPData.nSmoothing = pServerContext[29];
-            m_aIPData.bInvertImage = (pServerContext[34] == 0x01);
-            m_aIPData.bAutoContrast = (pServerContext[44] == 0x00);
+            m_aIPData.nBrightness = aServerContext[14];
+            m_aIPData.nContrast = aServerContext[19];
+            m_aIPData.nEdgeEnchancement = aServerContext[24];
+            m_aIPData.nSmoothing = aServerContext[29];
+            m_aIPData.bInvertImage = (aServerContext[34] == 0x01);
+            m_aIPData.bAutoContrast = (aServerContext[44] == 0x00);
         }
     }
     m_pObjStrm->QuickReaduInt16(); //disksize
@@ -153,7 +152,6 @@ void LwpGraphicObject::Read()
     }
     m_nCachedBaseLine = m_pObjStrm->QuickReadInt32();
     m_bIsLinked = m_pObjStrm->QuickReadInt16();
-    unsigned char * pFilterContext = nullptr;
 
     if (m_bIsLinked)
     {
@@ -170,8 +168,8 @@ void LwpGraphicObject::Read()
                 nFilterContextSize = nMaxPossibleSize;
             }
 
-            pFilterContext = new unsigned char[nFilterContextSize];
-            m_pObjStrm->QuickRead(pFilterContext, static_cast<sal_uInt16>(nFilterContextSize));
+            std::vector<unsigned char> aFilterContext(nFilterContextSize);
+            m_pObjStrm->QuickRead(aFilterContext.data(), static_cast<sal_uInt16>(nFilterContextSize));
         }
         if (LwpFileHeader::m_nFileRevision >= 0x000b)
         {
@@ -200,9 +198,6 @@ void LwpGraphicObject::Read()
     {
         m_WatermarkName = m_pObjStrm->QuickReadStringPtr();
     }
-
-    delete[] pServerContext;
-    delete[] pFilterContext;
 }
 
 void LwpGraphicObject::XFConvert (XFContentContainer* pCont)


More information about the Libreoffice-commits mailing list