From 2489000d3fd66319a8355fd4e37cfdfda47296d0 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 31 Jan 2017 14:46:38 +0200 Subject: loplugin:useuniqueptr extend to check local vars just the simple and obvious case for now, of a local var being allocated and deleted inside a single local block, and the delete happening at the end of the block Change-Id: I3a7a094da543debdcd2374737c2ecff91d644625 Reviewed-on: https://gerrit.libreoffice.org/33749 Tested-by: Jenkins Reviewed-by: Noel Grandin --- stoc/source/inspect/introspection.cxx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'stoc') diff --git a/stoc/source/inspect/introspection.cxx b/stoc/source/inspect/introspection.cxx index 033f2e7a8536..3ea435b9dcc1 100644 --- a/stoc/source/inspect/introspection.cxx +++ b/stoc/source/inspect/introspection.cxx @@ -1871,8 +1871,8 @@ css::uno::Reference Implementation::inspect( REMOVE_LISTENER_METHOD, // remove method of a listener interface INVALID_METHOD // method whose class is not considered, e.g. XPropertySet }; - MethodType* pMethodTypes = new MethodType[ nSourceMethodCount ]; - sal_Int32* pLocalMethodConcepts = new sal_Int32[ nSourceMethodCount ]; + std::unique_ptr pMethodTypes( new MethodType[ nSourceMethodCount ] ); + std::unique_ptr pLocalMethodConcepts( new sal_Int32[ nSourceMethodCount ] ); for( i = 0 ; i < nSourceMethodCount ; i++ ) { pMethodTypes[ i ] = STANDARD_METHOD; @@ -2354,9 +2354,6 @@ css::uno::Reference Implementation::inspect( // ignore them in the future if( bFoundXInterface ) bXInterfaceIsInvalid = true; - - delete[] pMethodTypes; - delete[] pLocalMethodConcepts; } // Do superclasses exist? Then continue here -- cgit