summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-04-30 16:00:41 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-04-30 16:02:59 +0100
commit2bb444ecb10436b640c1dc35e85cdcb512c8dff6 (patch)
treeda3c082afa4e59a36c5bbf5f98e9867aea144abd /oox
parent4d28399ccdeeb43655aba89f14c58b26d379c780 (diff)
see if a re-org will silence coverity#1272392 Resource leak
Change-Id: I65c20f75c4086dc5167c6fa41b0171f07c1419bb
Diffstat (limited to 'oox')
-rw-r--r--oox/inc/drawingml/table/tableproperties.hxx2
-rw-r--r--oox/source/drawingml/table/tableproperties.cxx16
2 files changed, 7 insertions, 11 deletions
diff --git a/oox/inc/drawingml/table/tableproperties.hxx b/oox/inc/drawingml/table/tableproperties.hxx
index ea03f7509adb..eb3ba78cd017 100644
--- a/oox/inc/drawingml/table/tableproperties.hxx
+++ b/oox/inc/drawingml/table/tableproperties.hxx
@@ -57,7 +57,7 @@ public:
private:
- const TableStyle& getUsedTableStyle( const ::oox::core::XmlFilterBase& rFilterBase, bool &isCreateTabStyle);
+ const TableStyle& getUsedTableStyle(const ::oox::core::XmlFilterBase& rFilterBase, TableStyle*& rTableStyleToDelete);
OUString maStyleId; // either StyleId is available
boost::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 393095b55c7e..380fcfb11bd2 100644
--- a/oox/source/drawingml/table/tableproperties.cxx
+++ b/oox/source/drawingml/table/tableproperties.cxx
@@ -221,7 +221,7 @@ TableStyle* CreateTableStyle(const OUString& styleId)
return pTableStyle;
}
-const TableStyle& TableProperties::getUsedTableStyle( const ::oox::core::XmlFilterBase& rFilterBase, bool &isCreateTabStyle )
+const TableStyle& TableProperties::getUsedTableStyle( const ::oox::core::XmlFilterBase& rFilterBase, TableStyle*& rTableStyleToDelete )
{
::oox::core::XmlFilterBase& rBase( const_cast< ::oox::core::XmlFilterBase& >( rFilterBase ) );
@@ -245,8 +245,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)
{
- pTableStyle = CreateTableStyle(aStyleId);
- isCreateTabStyle = (pTableStyle != NULL);
+ rTableStyleToDelete = CreateTableStyle(aStyleId);
+ pTableStyle = rTableStyleToDelete;
}
}
@@ -265,8 +265,8 @@ void TableProperties::pushToPropSet( const ::oox::core::XmlFilterBase& rFilterBa
CreateTableColumns( xColumnRowRange->getColumns(), mvTableGrid );
CreateTableRows( xColumnRowRange->getRows(), mvTableRows );
- bool bOwnTblStyle = false;
- const TableStyle& rTableStyle( getUsedTableStyle( rFilterBase, bOwnTblStyle ) );
+ TableStyle* pTableStyleToDelete = NULL;
+ const TableStyle& rTableStyle( getUsedTableStyle( rFilterBase, pTableStyleToDelete ) );
sal_Int32 nRow = 0;
const std::vector< TableRow >::const_iterator aTableRowEnd( mvTableRows.end() );
for (std::vector< TableRow >::iterator aTableRowIter( mvTableRows.begin() );
@@ -291,11 +291,7 @@ void TableProperties::pushToPropSet( const ::oox::core::XmlFilterBase& rFilterBa
}
}
- if(bOwnTblStyle)
- {
- TableStyle* pTableStyle = const_cast<TableStyle*>(&rTableStyle);
- delete pTableStyle;
- }
+ delete pTableStyleToDelete;
}
} } }