diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-31 14:46:38 +0200 |
---|---|---|
committer | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2017-12-05 08:17:11 -0500 |
commit | 9ca19666511b1d44ba554a70cbbc0c8e2db844c6 (patch) | |
tree | 39a0bd694d2f1cf5d5a67082b85717e5bb2cbef0 /stoc | |
parent | 6346e8c08e789e6aa4f2041fab97ba14419dedd4 (diff) |
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
Reviewed-on: https://gerrit.libreoffice.org/33749
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
(cherry picked from commit 2489000d3fd66319a8355fd4e37cfdfda47296d0)
Change-Id: I3a7a094da543debdcd2374737c2ecff91d644625
(cherry picked from commit e540ccfb5eb43bd4a3d6920074dce8436720ba8e)
Diffstat (limited to 'stoc')
-rw-r--r-- | stoc/source/inspect/introspection.cxx | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/stoc/source/inspect/introspection.cxx b/stoc/source/inspect/introspection.cxx index a755443f19c2..41e81263955c 100644 --- a/stoc/source/inspect/introspection.cxx +++ b/stoc/source/inspect/introspection.cxx @@ -1946,8 +1946,8 @@ css::uno::Reference<css::beans::XIntrospectionAccess> 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<MethodType[]> pMethodTypes( new MethodType[ nSourceMethodCount ] ); + std::unique_ptr<sal_Int32[]> pLocalMethodConcepts( new sal_Int32[ nSourceMethodCount ] ); for( i = 0 ; i < nSourceMethodCount ; i++ ) { pMethodTypes[ i ] = STANDARD_METHOD; @@ -2429,9 +2429,6 @@ css::uno::Reference<css::beans::XIntrospectionAccess> Implementation::inspect( // ignore them in the future if( bFoundXInterface ) bXInterfaceIsInvalid = true; - - delete[] pMethodTypes; - delete[] pLocalMethodConcepts; } // Do superclasses exist? Then continue here |