summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
Diffstat (limited to 'shell')
-rw-r--r--shell/source/win32/shlxthandler/util/utilities.cxx11
1 files changed, 7 insertions, 4 deletions
diff --git a/shell/source/win32/shlxthandler/util/utilities.cxx b/shell/source/win32/shlxthandler/util/utilities.cxx
index 78f960b07c11..66686a7e0d4b 100644
--- a/shell/source/win32/shlxthandler/util/utilities.cxx
+++ b/shell/source/win32/shlxthandler/util/utilities.cxx
@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <memory>
+
#include "config.hxx"
#include "utilities.hxx"
@@ -157,11 +161,10 @@ std::wstring getShortPathName( const std::wstring& aLongName )
if ( length != 0 )
{
- WCHAR* buffer = new WCHAR[ length+1 ];
- length = GetShortPathNameW( aLongName.c_str(), buffer, length );
+ auto buffer = std::unique_ptr<WCHAR[]>(new WCHAR[ length+1 ]);
+ length = GetShortPathNameW( aLongName.c_str(), buffer.get(), length );
if ( length != 0 )
- shortName = std::wstring( buffer );
- delete [] buffer;
+ shortName = std::wstring( buffer.get() );
}
return shortName;
}