Tim Clem : ntdll: Fix leak of mach_thread_self port.

Alexandre Julliard julliard at winehq.org
Tue Aug 9 15:19:54 CDT 2022


Module: wine
Branch: master
Commit: 317085fde560d99c5a9fc89d449502f1834edbdb
URL:    https://gitlab.winehq.org/wine/wine/-/commit/317085fde560d99c5a9fc89d449502f1834edbdb

Author: Tim Clem <tclem at codeweavers.com>
Date:   Mon Aug  8 10:06:44 2022 -0700

ntdll: Fix leak of mach_thread_self port.

---

 dlls/ntdll/unix/signal_x86_64.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c
index 1c2db47c95d..88c517daecf 100644
--- a/dlls/ntdll/unix/signal_x86_64.c
+++ b/dlls/ntdll/unix/signal_x86_64.c
@@ -3052,7 +3052,10 @@ static void *mac_thread_gsbase(void)
     unsigned int info_count = THREAD_IDENTIFIER_INFO_COUNT;
     static int gsbase_offset = -1;
 
-    kern_return_t kr = thread_info(mach_thread_self(), THREAD_IDENTIFIER_INFO, (thread_info_t) &tiinfo, &info_count);
+    mach_port_t self = mach_thread_self();
+    kern_return_t kr = thread_info(self, THREAD_IDENTIFIER_INFO, (thread_info_t) &tiinfo, &info_count);
+    mach_port_deallocate(mach_task_self(), self);
+
     if (kr == KERN_SUCCESS) return (void*)tiinfo.thread_handle;
 
     if (gsbase_offset < 0)




More information about the wine-cvs mailing list