[Libreoffice-commits] core.git: oox/inc oox/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Aug 7 08:57:38 UTC 2018


 oox/inc/drawingml/table/tableproperties.hxx    |    2 +-
 oox/source/drawingml/table/tableproperties.cxx |   12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit fe5afeda8c0a99bc97e1b2009b554d3a2ef4da70
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Aug 7 08:53:10 2018 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Aug 7 10:57:16 2018 +0200

    ofz#9747 Indirect-leak
    
    Change-Id: I1063fbe9f41833c70e28343dd8d2392acd579d6d
    Reviewed-on: https://gerrit.libreoffice.org/58665
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/oox/inc/drawingml/table/tableproperties.hxx b/oox/inc/drawingml/table/tableproperties.hxx
index 0cd500279974..af6671a81f23 100644
--- a/oox/inc/drawingml/table/tableproperties.hxx
+++ b/oox/inc/drawingml/table/tableproperties.hxx
@@ -61,7 +61,7 @@ public:
 
 private:
 
-    const TableStyle&                   getUsedTableStyle(const ::oox::core::XmlFilterBase& rFilterBase, TableStyle*& rTableStyleToDelete);
+    const TableStyle&                   getUsedTableStyle(const ::oox::core::XmlFilterBase& rFilterBase, std::unique_ptr<TableStyle>& rTableStyleToDelete);
 
     OUString                            maStyleId;              // either StyleId is available
     std::shared_ptr< TableStyle >       mpTableStyle;           // or the complete TableStyle
diff --git a/oox/source/drawingml/table/tableproperties.cxx b/oox/source/drawingml/table/tableproperties.cxx
index 3be685a954d3..00c5b765cfca 100644
--- a/oox/source/drawingml/table/tableproperties.cxx
+++ b/oox/source/drawingml/table/tableproperties.cxx
@@ -234,7 +234,7 @@ TableStyle* CreateTableStyle(const OUString& styleId)
     return pTableStyle;
 }
 
-const TableStyle& TableProperties::getUsedTableStyle( const ::oox::core::XmlFilterBase& rFilterBase, TableStyle*& rTableStyleToDelete )
+const TableStyle& TableProperties::getUsedTableStyle( const ::oox::core::XmlFilterBase& rFilterBase, std::unique_ptr<TableStyle>& rTableStyleToDelete )
 {
     ::oox::core::XmlFilterBase& rBase( const_cast< ::oox::core::XmlFilterBase& >( rFilterBase ) );
 
@@ -257,8 +257,8 @@ const TableStyle& TableProperties::getUsedTableStyle( const ::oox::core::XmlFilt
         //if the pptx just has table style id, but no table style content, we will create the table style ourselves
         if (!pTableStyle)
         {
-            rTableStyleToDelete = CreateTableStyle(aStyleId);
-            pTableStyle = rTableStyleToDelete;
+            rTableStyleToDelete.reset(CreateTableStyle(aStyleId));
+            pTableStyle = rTableStyleToDelete.get();
         }
     }
 
@@ -277,8 +277,8 @@ void TableProperties::pushToPropSet( const ::oox::core::XmlFilterBase& rFilterBa
     CreateTableColumns( xColumnRowRange->getColumns(), mvTableGrid );
     CreateTableRows( xColumnRowRange->getRows(), mvTableRows );
 
-    TableStyle* pTableStyleToDelete = nullptr;
-    const TableStyle& rTableStyle( getUsedTableStyle( rFilterBase, pTableStyleToDelete ) );
+    std::unique_ptr<TableStyle> xTableStyleToDelete;
+    const TableStyle& rTableStyle( getUsedTableStyle( rFilterBase, xTableStyleToDelete ) );
     sal_Int32 nRow = 0;
     for (auto & tableRow : mvTableRows)
     {
@@ -301,7 +301,7 @@ void TableProperties::pushToPropSet( const ::oox::core::XmlFilterBase& rFilterBa
         ++nRow;
     }
 
-    delete pTableStyleToDelete;
+    xTableStyleToDelete.reset();
 }
 
 } } }


More information about the Libreoffice-commits mailing list