[Libreoffice-commits] core.git: svx/source
Caolán McNamara
caolanm at redhat.com
Sun Sep 17 16:22:27 UTC 2017
svx/source/unodraw/UnoNameItemTable.cxx | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
New commits:
commit 64b7ff9f6ca03561d2d3db86d464545b282d4a3a
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Sep 17 12:58:21 2017 +0100
fix leak on exceptions
Change-Id: I88201acb472dbdb2c3b49945b962c5f2689d3bae
Reviewed-on: https://gerrit.libreoffice.org/42376
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/svx/source/unodraw/UnoNameItemTable.cxx b/svx/source/unodraw/UnoNameItemTable.cxx
index aad9ddc5949d..0a50dc3cfac2 100644
--- a/svx/source/unodraw/UnoNameItemTable.cxx
+++ b/svx/source/unodraw/UnoNameItemTable.cxx
@@ -82,11 +82,11 @@ void SAL_CALL SvxUnoNameItemTable::ImplInsertByName( const OUString& aName, cons
{
maItemSetVector.push_back( o3tl::make_unique< SfxItemSet >( *mpModelPool, std::initializer_list<SfxItemSet::Pair>{{mnWhich, mnWhich}} ) );
- std::unique_ptr<NameOrIndex> pNewItem(createItem());
- pNewItem->SetName( aName );
- pNewItem->PutValue( aElement, mnMemberId );
- pNewItem->SetWhich(mnWhich);
- maItemSetVector.back()->Put( *pNewItem );
+ std::unique_ptr<NameOrIndex> xNewItem(createItem());
+ xNewItem->SetName(aName);
+ xNewItem->PutValue(aElement, mnMemberId);
+ xNewItem->SetWhich(mnWhich);
+ maItemSetVector.back()->Put(*xNewItem);
}
// XNameContainer
@@ -153,12 +153,11 @@ void SAL_CALL SvxUnoNameItemTable::replaceByName( const OUString& aApiName, cons
const NameOrIndex *pItem = static_cast<const NameOrIndex *>(&((*aIter)->Get( mnWhich ) ));
if (aName == pItem->GetName())
{
- NameOrIndex* pNewItem = createItem();
- pNewItem->SetName(aName);
- if( !pNewItem->PutValue( aElement, mnMemberId ) || !isValid( pNewItem ) )
+ std::unique_ptr<NameOrIndex> xNewItem(createItem());
+ xNewItem->SetName(aName);
+ if (!xNewItem->PutValue(aElement, mnMemberId) || !isValid(xNewItem.get()))
throw lang::IllegalArgumentException();
-
- (*aIter)->Put( *pNewItem );
+ (*aIter)->Put(*xNewItem);
return;
}
++aIter;
More information about the Libreoffice-commits
mailing list