diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-08-15 11:44:05 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-08-15 14:59:50 +0200 |
commit | aa7c6cccd896f4ad7357dc819c668983ffc979e6 (patch) | |
tree | e1fd55eaca2ee3cf4eb9cd2d24ed8bceb41b1c45 /lotuswordpro/source | |
parent | 94f99ad38238f223b6fbed252e099581e0090e65 (diff) |
ofz#9910 Direct-leak
Change-Id: I14e5fbf8e572e9ea1fd8779434fd46ed43caac2c
Reviewed-on: https://gerrit.libreoffice.org/59069
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'lotuswordpro/source')
-rw-r--r-- | lotuswordpro/source/filter/lwpgrfobj.cxx | 25 |
1 files changed, 10 insertions, 15 deletions
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) |