diff options
author | Noel Grandin <noel@peralex.com> | 2015-11-10 13:36:34 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2015-11-11 07:16:20 +0000 |
commit | db17d3c17c40d6b0e92392cf3c6e343d1d17b771 (patch) | |
tree | 9d562fcf764e7717df9585ef0e735a12ea4aaa16 /sw/source/filter/html | |
parent | 2ce9e4be4a438203382cb9cca824ce3e90647f3a (diff) |
new loplugin: memoryvar
detect when we can convert a new/delete sequence on a local variable to
use std::unique_ptr
Change-Id: Iecae4e4197eccdfacfce2eed39aa4a69e4a660bc
Reviewed-on: https://gerrit.libreoffice.org/19884
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'sw/source/filter/html')
-rw-r--r-- | sw/source/filter/html/htmlforw.cxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sw/source/filter/html/htmlforw.cxx b/sw/source/filter/html/htmlforw.cxx index 37a8a73ee162..4388f16d093f 100644 --- a/sw/source/filter/html/htmlforw.cxx +++ b/sw/source/filter/html/htmlforw.cxx @@ -63,6 +63,7 @@ #include "htmlform.hxx" #include "frmfmt.hxx" #include <rtl/strbuf.hxx> +#include <memory> using namespace ::com::sun::star; @@ -1292,15 +1293,14 @@ static void AddControl( HTMLControls& rControls, if( xForm.is() ) { uno::Reference< container::XIndexContainer > xFormComps( xForm, uno::UNO_QUERY ); - HTMLControl *pHCntrl = new HTMLControl( xFormComps, nNodeIdx ); - HTMLControls::const_iterator it = rControls.find( pHCntrl ); + std::unique_ptr<HTMLControl> pHCntrl(new HTMLControl( xFormComps, nNodeIdx )); + HTMLControls::const_iterator it = rControls.find( pHCntrl.get() ); if( it == rControls.end() ) - rControls.insert( pHCntrl ); + rControls.insert( pHCntrl.release() ); else { if( (*it)->xFormComps==xFormComps ) (*it)->nCount++; - delete pHCntrl; } } } |