Kaydet (Commit) 2bb444ec authored tarafından Caolán McNamara's avatar Caolán McNamara

see if a re-org will silence coverity#1272392 Resource leak

Change-Id: I65c20f75c4086dc5167c6fa41b0171f07c1419bb
üst 4d28399c
...@@ -57,7 +57,7 @@ public: ...@@ -57,7 +57,7 @@ public:
private: 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 OUString maStyleId; // either StyleId is available
boost::shared_ptr< TableStyle > mpTableStyle; // or the complete TableStyle boost::shared_ptr< TableStyle > mpTableStyle; // or the complete TableStyle
......
...@@ -221,7 +221,7 @@ TableStyle* CreateTableStyle(const OUString& styleId) ...@@ -221,7 +221,7 @@ TableStyle* CreateTableStyle(const OUString& styleId)
return pTableStyle; 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 ) ); ::oox::core::XmlFilterBase& rBase( const_cast< ::oox::core::XmlFilterBase& >( rFilterBase ) );
...@@ -245,8 +245,8 @@ const TableStyle& TableProperties::getUsedTableStyle( const ::oox::core::XmlFilt ...@@ -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 the pptx just has table style id, but no table style content, we will create the table style ourselves
if (!pTableStyle) if (!pTableStyle)
{ {
pTableStyle = CreateTableStyle(aStyleId); rTableStyleToDelete = CreateTableStyle(aStyleId);
isCreateTabStyle = (pTableStyle != NULL); pTableStyle = rTableStyleToDelete;
} }
} }
...@@ -265,8 +265,8 @@ void TableProperties::pushToPropSet( const ::oox::core::XmlFilterBase& rFilterBa ...@@ -265,8 +265,8 @@ void TableProperties::pushToPropSet( const ::oox::core::XmlFilterBase& rFilterBa
CreateTableColumns( xColumnRowRange->getColumns(), mvTableGrid ); CreateTableColumns( xColumnRowRange->getColumns(), mvTableGrid );
CreateTableRows( xColumnRowRange->getRows(), mvTableRows ); CreateTableRows( xColumnRowRange->getRows(), mvTableRows );
bool bOwnTblStyle = false; TableStyle* pTableStyleToDelete = NULL;
const TableStyle& rTableStyle( getUsedTableStyle( rFilterBase, bOwnTblStyle ) ); const TableStyle& rTableStyle( getUsedTableStyle( rFilterBase, pTableStyleToDelete ) );
sal_Int32 nRow = 0; sal_Int32 nRow = 0;
const std::vector< TableRow >::const_iterator aTableRowEnd( mvTableRows.end() ); const std::vector< TableRow >::const_iterator aTableRowEnd( mvTableRows.end() );
for (std::vector< TableRow >::iterator aTableRowIter( mvTableRows.begin() ); for (std::vector< TableRow >::iterator aTableRowIter( mvTableRows.begin() );
...@@ -291,11 +291,7 @@ void TableProperties::pushToPropSet( const ::oox::core::XmlFilterBase& rFilterBa ...@@ -291,11 +291,7 @@ void TableProperties::pushToPropSet( const ::oox::core::XmlFilterBase& rFilterBa
} }
} }
if(bOwnTblStyle) delete pTableStyleToDelete;
{
TableStyle* pTableStyle = const_cast<TableStyle*>(&rTableStyle);
delete pTableStyle;
}
} }
} } } } } }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment