summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-07-17 17:24:05 +0200
committerStephan Bergmann <sbergman@redhat.com>2017-07-17 17:24:05 +0200
commit143b3a2f3c431b7277321471d5366e7e1e97a772 (patch)
tree1c2e0c31492161da0bcd9553e38cbe63e9f964a6 /shell
parent5e790f691add9e44b8ab558f5f0aae488ad71b6e (diff)
loplugin:useuniqueptr: shell (clang-cl)
Change-Id: Icf6cd85f9e4792ad09dd1a97a8802da13da942c2
Diffstat (limited to 'shell')
-rw-r--r--shell/source/win32/spsupp/COMOpenDocuments.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/shell/source/win32/spsupp/COMOpenDocuments.cxx b/shell/source/win32/spsupp/COMOpenDocuments.cxx
index ece3ba82f2ad..c1efe033409c 100644
--- a/shell/source/win32/spsupp/COMOpenDocuments.cxx
+++ b/shell/source/win32/spsupp/COMOpenDocuments.cxx
@@ -10,6 +10,7 @@
#include <sal/config.h>
#include <cstring>
+#include <vector>
#include "COMOpenDocuments.hpp"
#include "spsuppServ.hpp"
@@ -62,13 +63,12 @@ HRESULT LOStart(const wchar_t* sModeArg, const wchar_t* sFilePath, bool bDoSecur
0, nullptr);
size_t nBufSize = wcslen(sMsgBuf) + 100;
- wchar_t* sDisplayBuf = new wchar_t[nBufSize];
- swprintf(sDisplayBuf, nBufSize, L"Could not start LibreOffice. Error is 0x%08X:\n\n%s", dwError, sMsgBuf);
+ std::vector<wchar_t> sDisplayBuf(nBufSize);
+ swprintf(sDisplayBuf.data(), nBufSize, L"Could not start LibreOffice. Error is 0x%08X:\n\n%s", dwError, sMsgBuf);
LocalFree(sMsgBuf);
// Report the error to user and return error
- MessageBoxW(nullptr, sDisplayBuf, nullptr, MB_ICONERROR);
- delete[](sDisplayBuf);
+ MessageBoxW(nullptr, sDisplayBuf.data(), nullptr, MB_ICONERROR);
return HRESULT_FROM_WIN32(dwError);
}
CloseHandle(pi.hProcess);