[Libreoffice-commits] core.git: sc/source sd/source sw/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Sat Jun 27 18:25:47 UTC 2020


 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(-)

New commits:
commit ae1b0875b2d65513ff013054d6e04aa7f715eaa4
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat Jun 27 16:18:35 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sat Jun 27 20:25:10 2020 +0200

    cid#1464973 & cid#1464975 Resource leak
    
    Change-Id: I4df8fefa7f875e0a25585c4fef22f077dcd0b83d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97318
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

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<SotStorage> 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<SotStorageStream> 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 3fbbcea1b772..7b6876af7535 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<SotStorage> xSubStorage = pStorage->OpenSotStorage(aElement.GetName(), StreamMode::STD_READ | StreamMode::SHARE_DENYALL);
+            lcl_getListOfStreams(xSubStorage.get(), aStreamsData, sStreamFullName);
         }
         else
         {
@@ -306,7 +306,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<SotStorage> 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 58d423d3b9a5..bd71f59d7357 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -3722,7 +3722,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<SotStorage> pStorage = m_pStg.get();
             OUString sFileName;
             sal_Int32 idx = 0;
             while (pStorage && idx >= 0)
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 546689fc065a..adbd5f6c9e26 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<SotStorage> xSubStorage = pStorage->OpenSotStorage(aElement.GetName(), StreamMode::STD_READ | StreamMode::SHARE_DENYALL);
+            lcl_getListOfStreams(xSubStorage.get(), aStreamsData, sStreamFullName);
         }
         else
         {


More information about the Libreoffice-commits mailing list