diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-01-11 08:58:53 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-01-11 13:21:45 +0100 |
commit | 4a0f40113d83742792d765eb1abcbb239cbbf2dd (patch) | |
tree | 9381e416bbb97aee8ec2d33ad4411d756cf88e14 | |
parent | 0f2104cd745329852e6a6d9c93f6af7c5a8c646a (diff) |
ofz#5234 Direct-leak
Change-Id: I0a4f70423be3c7cc4ccdc593f743102922f9c284
Reviewed-on: https://gerrit.libreoffice.org/47743
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | lotuswordpro/source/filter/bencont.cxx | 29 |
1 files changed, 13 insertions, 16 deletions
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); |