lotuswordpro/source/filter/bencont.cxx | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-)
New commits: commit 4a0f40113d83742792d765eb1abcbb239cbbf2dd Author: Caolán McNamara <caol...@redhat.com> Date: Thu Jan 11 08:58:53 2018 +0000 ofz#5234 Direct-leak Change-Id: I0a4f70423be3c7cc4ccdc593f743102922f9c284 Reviewed-on: https://gerrit.libreoffice.org/47743 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/lotuswordpro/source/filter/bencont.cxx b/lotuswordpro/source/filter/bencont.cxx index 11df27e810d5..52c82292c8ea 100644 --- a/lotuswordpro/source/filter/bencont.cxx +++ b/lotuswordpro/source/filter/bencont.cxx @@ -283,22 +283,19 @@ void LtcBenContainer::CreateGraphicStream(SvStream * &pStream, const char *pObje sprintf(sDName, "%s-D", pObjectName); /* traverse the found properties and construct the stream vectors */ - SvMemoryStream * pMemStream = nullptr; // get S&D's stream and merge them together - SvStream *pD = nullptr, *pS = nullptr; - - pS = FindValueStreamWithPropertyName(sSName); - pD = FindValueStreamWithPropertyName(sDName); + std::unique_ptr<SvStream> xS(FindValueStreamWithPropertyName(sSName)); + std::unique_ptr<SvStream> xD(FindValueStreamWithPropertyName(sDName)); sal_uInt32 nDLen = 0; - if(pD) + if (xD) { - nDLen = GetSvStreamSize(pD); + nDLen = GetSvStreamSize(xD.get()); } sal_uInt32 nLen = nDLen; - if(pS) + if (xS) { - nLen += GetSvStreamSize(pS) ; + nLen += GetSvStreamSize(xS.get()) ; } OSL_ENSURE(nLen > 0, "expected a non-0 length"); @@ -312,19 +309,19 @@ void LtcBenContainer::CreateGraphicStream(SvStream * &pStream, const char *pObje char * pBuf = new char[nLen]; assert(pBuf != nullptr); char * pPointer = pBuf; - if(pD) + if (xD) { - pD->ReadBytes(pPointer, nDLen); - delete pD; + xD->ReadBytes(pPointer, nDLen); + xD.reset(); } pPointer += nDLen; - if(pS) + if (xS) { - pS->ReadBytes(pPointer, nLen - nDLen); - delete pS; + xS->ReadBytes(pPointer, nLen - nDLen); + xS.reset(); } - pMemStream = new SvMemoryStream(pBuf, nLen, StreamMode::READ); + SvMemoryStream* pMemStream = new SvMemoryStream(pBuf, nLen, StreamMode::READ); assert(pMemStream != nullptr); pMemStream->ObjectOwnsMemory(true); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits