Kaydet (Commit) aef44b5a authored tarafından Mike Kaganski's avatar Mike Kaganski

Cppcheck: release the handle that CreateThread returns

Change-Id: I4d6d04873d69d2ff1e5409372b353e0bb9a5d68d
Reviewed-on: https://gerrit.libreoffice.org/60120Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
Reviewed-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
üst 58008a0f
......@@ -181,7 +181,7 @@ LRESULT AWindow::OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled
data.evtThreadReady= CreateEvent( NULL, FALSE, FALSE, NULL);
HANDLE hThread= CreateThread( NULL, 0, MTAFunc, &data, 0, &mtaThreadId);
CloseHandle(CreateThread(NULL, 0, MTAFunc, &data, 0, &mtaThreadId));
// We must wait until the thread copied the ThreadData structure
WaitForSingleObject( data.evtThreadReady, INFINITE);
CloseHandle( data.evtThreadReady);
......
......@@ -221,13 +221,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);
}
}
......
......@@ -528,7 +528,7 @@ void win32_init_sys_tray()
);
DWORD dwThreadId;
CreateThread( nullptr, 0, SystrayThread, nullptr, 0, &dwThreadId );
CloseHandle(CreateThread(nullptr, 0, SystrayThread, nullptr, 0, &dwThreadId));
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment