diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-26 12:06:27 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-26 13:30:49 +0200 |
commit | 4054dff516367b332b7e3ce6fa91a452bf690571 (patch) | |
tree | 74ce35623e84933e4da9b134855ac1c74c4bce1d /chart2/source | |
parent | c0cc59adca23580864a2e5cdadf66212246cbfcc (diff) |
use unique_ptr when Clone()'ing PoolItems
and fix a handful of small leaks in the process
Change-Id: I876e12ff5305f9dda84532d4182fb91657d6fa0c
Reviewed-on: https://gerrit.libreoffice.org/62389
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2/source')
-rw-r--r-- | chart2/source/controller/itemsetwrapper/ItemConverter.cxx | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/chart2/source/controller/itemsetwrapper/ItemConverter.cxx b/chart2/source/controller/itemsetwrapper/ItemConverter.cxx index 9d4fd5669841..a463fc176b82 100644 --- a/chart2/source/controller/itemsetwrapper/ItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/ItemConverter.cxx @@ -97,28 +97,22 @@ void ItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const if( GetItemProperty( nWhich, aProperty )) { // put the Property into the itemset - SfxPoolItem * pItem = rPool.GetDefaultItem( nWhich ).Clone(); + std::unique_ptr<SfxPoolItem> pItem(rPool.GetDefaultItem( nWhich ).Clone()); if( pItem ) { try { - if( ! pItem->PutValue( m_xPropertySet->getPropertyValue( aProperty.first ), + if( pItem->PutValue( m_xPropertySet->getPropertyValue( aProperty.first ), aProperty.second // nMemberId )) { - delete pItem; - } - else - { pItem->SetWhich(nWhich); rOutItemSet.Put( *pItem ); - delete pItem; } } catch( const beans::UnknownPropertyException &ex ) { - delete pItem; SAL_WARN( "chart2", ex << " - unknown Property: " << aProperty.first); } catch( const uno::Exception & ) |