summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-09-07 07:05:32 +0200
committerJuergen Funk (CIB) <juergen.funk_ml@cib.de>2019-06-04 09:02:23 +0200
commit0ae5ee9341f2dbd4b272b6d1302decaad0f9e152 (patch)
tree63f485b565680fdaa054fcecfb246f2fec098cdb /sal
parent6a48679fc4a38f34f8bf0c1ff0a4ef7bad384b9c (diff)
Cppcheck: release the handle that CreateThread returns
Change-Id: I4d6d04873d69d2ff1e5409372b353e0bb9a5d68d Reviewed-on: https://gerrit.libreoffice.org/60120 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> (cherry picked from commit aef44b5a71d6d2bd8e399d2cb35bce6d6023fbf8) Reviewed-on: https://gerrit.libreoffice.org/73429 Reviewed-by: Juergen Funk (CIB) <juergen.funk_ml@cib.de> Tested-by: Juergen Funk (CIB) <juergen.funk_ml@cib.de>
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/w32/dllentry.cxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/sal/osl/w32/dllentry.cxx b/sal/osl/w32/dllentry.cxx
index ffdaeb80dac9..5dd8151a58c3 100644
--- a/sal/osl/w32/dllentry.cxx
+++ b/sal/osl/w32/dllentry.cxx
@@ -222,13 +222,17 @@ BOOL WINAPI DllMain( HINSTANCE, DWORD fdwReason, LPVOID )
{
// No error check, it works or it does not
// Thread should only be started for headless mode, see desktop/win32/source/officeloader.cxx
- CreateThread( nullptr, 0, ParentMonitorThreadProc, reinterpret_cast<LPVOID>(dwParentProcessId), 0, &dwThreadId );
+ HANDLE hThread
+ = CreateThread(nullptr, 0, ParentMonitorThreadProc,
+ reinterpret_cast<LPVOID>(dwParentProcessId), 0, &dwThreadId);
// Note: calling CreateThread in DllMain is discouraged
// but this is only done in the headless mode and in
// that case no other threads should be running at startup
// when sal3.dll is loaded; also there is no
// synchronization with the spawned thread, so there
// does not appear to be a real risk of deadlock here
+ if (hThread)
+ CloseHandle(hThread);
}
}