summaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2023-04-22 16:06:07 +0200
committerMike Kaganski <mike.kaganski@collabora.com>2023-04-22 17:45:40 +0200
commit8de1bf3674b5f5391ff1be229d99115107514877 (patch)
treebb0857cf844556380d2bf94b25e07878049b1f16 /extensions
parent31486f92f9ec0c2446ad96a4e8228a15797b23ba (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 'extensions')
-rw-r--r--extensions/source/scanner/twain32shim.cxx6
1 files changed, 3 insertions, 3 deletions
diff --git a/extensions/source/scanner/twain32shim.cxx b/extensions/source/scanner/twain32shim.cxx
index beca35f4f26b..6e0be8149471 100644
--- a/extensions/source/scanner/twain32shim.cxx
+++ b/extensions/source/scanner/twain32shim.cxx
@@ -28,6 +28,7 @@
*/
#include "twain32shim.hxx"
+#include <systools/win32/comtools.hxx>
#include <tools/helpers.hxx>
#include <twain/twain.h>
#include <o3tl/unit_conversion.hxx>
@@ -251,11 +252,10 @@ void ImpTwain::ImplOpenSourceManager()
if (!m_hMod)
{
// Windows directory might not be in DLL search path sometimes, so try the full path
- PWSTR sPath;
+ sal::systools::CoTaskMemAllocated<wchar_t> sPath;
if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_Windows, 0, nullptr, &sPath)))
{
- std::wstring sPathAndFile = sPath;
- CoTaskMemFree(sPath);
+ std::wstring sPathAndFile(sPath);
sPathAndFile += L"\\TWAIN_32.DLL";
m_hMod = LoadLibraryW(sPathAndFile.c_str());
}