diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-08-01 14:50:54 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2014-08-04 12:49:59 +0000 |
commit | 02f0102b8bd7793ddd2fe7a54c46d41b9a608cec (patch) | |
tree | 681ab6c40925a32a71cc6361cf538bced70d7c23 /sd | |
parent | 4189b715999bf9ebb0cd04a0c610a7b514e28d1b (diff) |
prevent memory leak
Found by Lsan.
Returning this or a heap allocated object asks for trouble. Let the
caller handle it and return null instead of this.
Change-Id: I7586e103bef5a8c2727adfe214b052d6962d4467
Reviewed-on: https://gerrit.libreoffice.org/10716
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/func/futempl.cxx | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sd/source/ui/func/futempl.cxx b/sd/source/ui/func/futempl.cxx index 303e0b34aef9..e352bd29978f 100644 --- a/sd/source/ui/func/futempl.cxx +++ b/sd/source/ui/func/futempl.cxx @@ -441,7 +441,7 @@ void FuTemplate::DoExecute( SfxRequest& rReq ) { const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_FILLBITMAP ); SfxPoolItem* pNewItem = ((XFillBitmapItem*)pOldItem)->checkForUniqueItem( mpDoc ); - if( pOldItem != pNewItem ) + if( pNewItem ) { rAttr.Put( *pNewItem ); delete pNewItem; @@ -451,7 +451,7 @@ void FuTemplate::DoExecute( SfxRequest& rReq ) { const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_LINEDASH ); SfxPoolItem* pNewItem = ((XLineDashItem*)pOldItem)->checkForUniqueItem( mpDoc ); - if( pOldItem != pNewItem ) + if( pNewItem ) { rAttr.Put( *pNewItem ); delete pNewItem; @@ -461,7 +461,7 @@ void FuTemplate::DoExecute( SfxRequest& rReq ) { const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_LINESTART ); SfxPoolItem* pNewItem = ((XLineStartItem*)pOldItem)->checkForUniqueItem( mpDoc ); - if( pOldItem != pNewItem ) + if( pNewItem ) { rAttr.Put( *pNewItem ); delete pNewItem; @@ -471,7 +471,7 @@ void FuTemplate::DoExecute( SfxRequest& rReq ) { const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_LINEEND ); SfxPoolItem* pNewItem = ((XLineEndItem*)pOldItem)->checkForUniqueItem( mpDoc ); - if( pOldItem != pNewItem ) + if( pNewItem ) { rAttr.Put( *pNewItem ); delete pNewItem; @@ -481,7 +481,7 @@ void FuTemplate::DoExecute( SfxRequest& rReq ) { const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_FILLGRADIENT ); SfxPoolItem* pNewItem = ((XFillGradientItem*)pOldItem)->checkForUniqueItem( mpDoc ); - if( pOldItem != pNewItem ) + if( pNewItem ) { rAttr.Put( *pNewItem ); delete pNewItem; @@ -491,7 +491,7 @@ void FuTemplate::DoExecute( SfxRequest& rReq ) { const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_FILLFLOATTRANSPARENCE ); SfxPoolItem* pNewItem = ((XFillFloatTransparenceItem*)pOldItem)->checkForUniqueItem( mpDoc ); - if( pOldItem != pNewItem ) + if( pNewItem ) { rAttr.Put( *pNewItem ); delete pNewItem; @@ -501,7 +501,7 @@ void FuTemplate::DoExecute( SfxRequest& rReq ) { const SfxPoolItem* pOldItem = rAttr.GetItem( XATTR_FILLHATCH ); SfxPoolItem* pNewItem = ((XFillHatchItem*)pOldItem)->checkForUniqueItem( mpDoc ); - if( pOldItem != pNewItem ) + if( pNewItem ) { rAttr.Put( *pNewItem ); delete pNewItem; |