diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2023-04-22 16:06:07 +0200 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2023-04-22 17:45:40 +0200 |
commit | 8de1bf3674b5f5391ff1be229d99115107514877 (patch) | |
tree | bb0857cf844556380d2bf94b25e07878049b1f16 /xmlsecurity | |
parent | 31486f92f9ec0c2446ad96a4e8228a15797b23ba (diff) |
Introduce sal::systools::CoTaskMemAllocated to use RAII for CoTaskMemFree
Change-Id: I5553138bfc8dd989e68b8bcc2be981746e8c1e84
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150783
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'xmlsecurity')
-rw-r--r-- | xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx index 6e4593696234..0a306a008db0 100644 --- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx +++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx @@ -67,7 +67,7 @@ #ifdef _WIN32 #include <o3tl/char16_t2wchar_t.hxx> -#include <prewin.h> +#include <systools/win32/comtools.hxx> #include <Shlobj.h> #endif @@ -490,16 +490,12 @@ IMPL_LINK_NOARG(DigitalSignaturesDialog, CertMgrButtonHdl, weld::Button&, void) u"GNU\\GnuPG\\bin\\gpa.exe", }; static const OUString aPath = [] { - OUString sRet; - PWSTR sPath = nullptr; + sal::systools::CoTaskMemAllocated<wchar_t> sPath; HRESULT hr = SHGetKnownFolderPath(FOLDERID_ProgramFilesX86, KF_FLAG_DEFAULT, nullptr, &sPath); if (SUCCEEDED(hr)) - { - sRet = o3tl::toU(sPath); - CoTaskMemFree(sPath); - } - return sRet; + return OUString(o3tl::toU(sPath)); + return OUString(); }(); if (aPath.isEmpty()) return; |