dtrans/test/win32/dnd/atlwindow.cxx  |    2 +-
 sal/osl/w32/dllentry.cxx             |    6 +++++-
 sfx2/source/appl/shutdowniconw32.cxx |    2 +-
 3 files changed, 7 insertions(+), 3 deletions(-)

New commits:
commit 0ae5ee9341f2dbd4b272b6d1302decaad0f9e152
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Fri Sep 7 07:05:32 2018 +0200
Commit:     Juergen Funk (CIB) <juergen.funk...@cib.de>
CommitDate: Tue Jun 4 09:02:23 2019 +0200

    Cppcheck: release the handle that CreateThread returns
    
    Change-Id: I4d6d04873d69d2ff1e5409372b353e0bb9a5d68d
    Reviewed-on: https://gerrit.libreoffice.org/60120
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    (cherry picked from commit aef44b5a71d6d2bd8e399d2cb35bce6d6023fbf8)
    Reviewed-on: https://gerrit.libreoffice.org/73429
    Reviewed-by: Juergen Funk (CIB) <juergen.funk...@cib.de>
    Tested-by: Juergen Funk (CIB) <juergen.funk...@cib.de>

diff --git a/dtrans/test/win32/dnd/atlwindow.cxx 
b/dtrans/test/win32/dnd/atlwindow.cxx
index 7aa0df7ce0ac..9e1e2e1fc693 100644
--- a/dtrans/test/win32/dnd/atlwindow.cxx
+++ b/dtrans/test/win32/dnd/atlwindow.cxx
@@ -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);
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);
                 }
             }
 
diff --git a/sfx2/source/appl/shutdowniconw32.cxx 
b/sfx2/source/appl/shutdowniconw32.cxx
index f96968186948..37fc3a30e88d 100644
--- a/sfx2/source/appl/shutdowniconw32.cxx
+++ b/sfx2/source/appl/shutdowniconw32.cxx
@@ -527,7 +527,7 @@ void win32_init_sys_tray()
             );
 
         DWORD   dwThreadId;
-        CreateThread( nullptr, 0, SystrayThread, nullptr, 0, &dwThreadId );
+        CloseHandle(CreateThread(nullptr, 0, SystrayThread, nullptr, 0, 
&dwThreadId));
     }
 }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to