diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-04-06 09:46:06 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-04-06 09:22:46 +0000 |
commit | aa09b0c27a6d925da428d6267daadc7338829869 (patch) | |
tree | b0fa576ff64820061d9fb876bebacd23e58ddc56 /filter/source/msfilter/escherex.cxx | |
parent | 0c82dff153d92150729815b919854a9a350aa031 (diff) |
loplugin:useuniqueptr extend to catch more localvar cases
i.e. where the code looks like
{
foo * p = new foo;
...
delete p;
return ...;
}
Change-Id: Id5f2e55d0363fc62c72535a23faeaaf1f0ac6aee
Reviewed-on: https://gerrit.libreoffice.org/36190
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'filter/source/msfilter/escherex.cxx')
-rw-r--r-- | filter/source/msfilter/escherex.cxx | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index 122dca177e20..7b8f679ffa7d 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -4196,7 +4196,7 @@ sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, const OStrin sal_uInt32 nBlibId = 0; std::unique_ptr<GraphicObject> xGraphicObject(new GraphicObject(rId)); - EscherBlibEntry* p_EscherBlibEntry = new EscherBlibEntry( rPicOutStrm.Tell(), *xGraphicObject, rId, pGraphicAttr ); + std::unique_ptr<EscherBlibEntry> p_EscherBlibEntry( new EscherBlibEntry( rPicOutStrm.Tell(), *xGraphicObject, rId, pGraphicAttr ) ); if ( !p_EscherBlibEntry->IsEmpty() ) { for ( sal_uInt32 i = 0; i < mnBlibEntrys; i++ ) @@ -4204,7 +4204,6 @@ sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, const OStrin if ( *( mpBlibEntrys[ i ] ) == *p_EscherBlibEntry ) { mpBlibEntrys[ i ]->mnRefCount++; - delete p_EscherBlibEntry; return i + 1; } } @@ -4433,11 +4432,9 @@ sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, const OStrin rPicOutStrm.WriteUInt32( nPos - nAtomSize ); rPicOutStrm.Seek( nPos ); } - nBlibId = ImplInsertBlib( p_EscherBlibEntry ); - p_EscherBlibEntry = nullptr; + nBlibId = ImplInsertBlib( p_EscherBlibEntry.release() ); } } - delete p_EscherBlibEntry; return nBlibId; } |