From 81c7702865551e2f8a5bbcde2c8e37e4446c387c Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sat, 27 Jun 2020 16:18:35 +0100 Subject: cid#1464973 & cid#1464975 Resource leak MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I4df8fefa7f875e0a25585c4fef22f077dcd0b83d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97300 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- sc/source/filter/excel/excel.cxx | 6 +++--- sd/source/filter/sdpptwrp.cxx | 6 +++--- sw/source/filter/ww8/wrtww8.cxx | 2 +- sw/source/filter/ww8/ww8par.cxx | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/sc/source/filter/excel/excel.cxx b/sc/source/filter/excel/excel.cxx index 34dd49a81c8b..1e2c61233a2c 100644 --- a/sc/source/filter/excel/excel.cxx +++ b/sc/source/filter/excel/excel.cxx @@ -59,8 +59,8 @@ static void lcl_getListOfStreams(SotStorage * pStorage, comphelper::SequenceAsHa OUString sStreamFullName = sPrefix.getLength() ? sPrefix + "/" + aElement.GetName() : aElement.GetName(); if (aElement.IsStorage()) { - SotStorage * pSubStorage = pStorage->OpenSotStorage(aElement.GetName(), StreamMode::STD_READ | StreamMode::SHARE_DENYALL); - lcl_getListOfStreams(pSubStorage, aStreamsData, sStreamFullName); + tools::SvRef xSubStorage = pStorage->OpenSotStorage(aElement.GetName(), StreamMode::STD_READ | StreamMode::SHARE_DENYALL); + lcl_getListOfStreams(xSubStorage.get(), aStreamsData, sStreamFullName); } else { @@ -371,7 +371,7 @@ static ErrCode lcl_ExportExcelBiff( SfxMedium& rMedium, ScDocument *pDocument, break; } - SotStorageStream* pStream = pStorage->OpenSotStream(sFileName); + tools::SvRef pStream = pStorage->OpenSotStream(sFileName); if (!pStream) { eRet = ERRCODE_IO_GENERAL; diff --git a/sd/source/filter/sdpptwrp.cxx b/sd/source/filter/sdpptwrp.cxx index 68b0b1886fd2..8fac3b162263 100644 --- a/sd/source/filter/sdpptwrp.cxx +++ b/sd/source/filter/sdpptwrp.cxx @@ -83,8 +83,8 @@ static void lcl_getListOfStreams(SotStorage * pStorage, comphelper::SequenceAsHa OUString sStreamFullName = sPrefix.getLength() ? sPrefix + "/" + aElement.GetName() : aElement.GetName(); if (aElement.IsStorage()) { - SotStorage * pSubStorage = pStorage->OpenSotStorage(aElement.GetName(), StreamMode::STD_READ | StreamMode::SHARE_DENYALL); - lcl_getListOfStreams(pSubStorage, aStreamsData, sStreamFullName); + tools::SvRef xSubStorage = pStorage->OpenSotStorage(aElement.GetName(), StreamMode::STD_READ | StreamMode::SHARE_DENYALL); + lcl_getListOfStreams(xSubStorage.get(), aStreamsData, sStreamFullName); } else { @@ -307,7 +307,7 @@ bool SdPPTFilter::Export() { // To avoid long paths split and open substorages recursively // Splitting paths manually, since comphelper::string::split is trimming special characters like \0x01, \0x09 - SotStorage * pStorage = xEncryptedRootStrg.get(); + tools::SvRef pStorage = xEncryptedRootStrg.get(); OUString sFileName; sal_Int32 idx = 0; do diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 5fedd5bb39b7..9b5980f3e5e1 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -3724,7 +3724,7 @@ ErrCode SwWW8Writer::WriteStorage() { // To avoid long paths split and open substorages recursively // Splitting paths manually, since comphelper::string::split is trimming special characters like \0x01, \0x09 - SotStorage * pStorage = m_pStg.get(); + tools::SvRef pStorage = m_pStg.get(); OUString sFileName; sal_Int32 idx = 0; do diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index f58506ec5268..054b0a98e9ee 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -6343,8 +6343,8 @@ static void lcl_getListOfStreams(SotStorage * pStorage, comphelper::SequenceAsHa OUString sStreamFullName = sPrefix.getLength() ? sPrefix + "/" + aElement.GetName() : aElement.GetName(); if (aElement.IsStorage()) { - SotStorage * pSubStorage = pStorage->OpenSotStorage(aElement.GetName(), StreamMode::STD_READ | StreamMode::SHARE_DENYALL); - lcl_getListOfStreams(pSubStorage, aStreamsData, sStreamFullName); + tools::SvRef xSubStorage = pStorage->OpenSotStorage(aElement.GetName(), StreamMode::STD_READ | StreamMode::SHARE_DENYALL); + lcl_getListOfStreams(xSubStorage.get(), aStreamsData, sStreamFullName); } else { -- cgit