diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-02-02 15:17:52 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-02-02 15:17:52 +0100 |
commit | 5595ee701eab0fef0683c93e3c99788ab1b08520 (patch) | |
tree | f65921d6b5b0c8c988fa37eb4dc57e2879d25bf2 /shell | |
parent | 19c0eff34a5e1de4f3aff723b7750d4e01d4ba6d (diff) |
loplugin:useuniqueptr
Change-Id: I3a246a22baaac8195dc1b94c42994de7d80e8336
Diffstat (limited to 'shell')
-rw-r--r-- | shell/source/win32/shlxthandler/propsheets/propsheets.cxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/shell/source/win32/shlxthandler/propsheets/propsheets.cxx b/shell/source/win32/shlxthandler/propsheets/propsheets.cxx index 9d524e990d00..1ac28c349319 100644 --- a/shell/source/win32/shlxthandler/propsheets/propsheets.cxx +++ b/shell/source/win32/shlxthandler/propsheets/propsheets.cxx @@ -36,6 +36,7 @@ #pragma warning(pop) #endif +#include <memory> #include <string> #include <vector> #include <utility> @@ -139,12 +140,12 @@ HRESULT STDMETHODCALLTYPE CPropertySheet::Initialize( UINT size = DragQueryFileW( static_cast<HDROP>(medium.hGlobal), 0, nullptr, 0 ); if ( size != 0 ) { - WCHAR * buffer = new WCHAR[ size + 1 ]; + auto buffer = std::unique_ptr<WCHAR[]>(new WCHAR[ size + 1 ]); UINT result_size = DragQueryFileW( static_cast<HDROP>(medium.hGlobal), - 0, buffer, size + 1 ); + 0, buffer.get(), size + 1 ); if ( result_size != 0 ) { - std::wstring fname = getShortPathName( buffer ); + std::wstring fname = getShortPathName( buffer.get() ); std::string fnameA = WStringToString( fname ); ZeroMemory( m_szFileName, sizeof( m_szFileName ) ); strncpy( m_szFileName, fnameA.c_str(), ( sizeof( m_szFileName ) - 1 ) ); @@ -152,7 +153,6 @@ HRESULT STDMETHODCALLTYPE CPropertySheet::Initialize( } else hr = E_INVALIDARG; - delete [] buffer; } else hr = E_INVALIDARG; |