From: Sebastian Lackner Subject: ntdll: Fix leaking activation context when terminating via exit_thread(). (Valgrind) Message-Id: <53A63751.6050704@fds-team.de> Date: Sun, 22 Jun 2014 03:54:25 +0200 Fixes https://bugs.winehq.org/show_bug.cgi?id=36782 There are multiple ways to terminate a thread, either by calling ExitThread, RtlExitUserThread or just by returning from the thread callback function (this is what we use in the test). All methods should release the thread activation context stack (currently only ExitThread does). The easiest way to fix that is to move the call into the ntdll exit_thread(...) function. --- dlls/kernel32/thread.c | 1 - dlls/ntdll/thread.c | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) From 0ca7982fadcc4189d7139475e3d9f40958aabba6 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sun, 22 Jun 2014 03:27:31 +0200 Subject: ntdll: Fix leaking activation context when terminating via exit_thread(). --- dlls/kernel32/thread.c | 1 - dlls/ntdll/thread.c | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/kernel32/thread.c b/dlls/kernel32/thread.c index 5d87cdd..5b9a683 100644 --- a/dlls/kernel32/thread.c +++ b/dlls/kernel32/thread.c @@ -150,7 +150,6 @@ HANDLE WINAPI OpenThread( DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwTh */ void WINAPI ExitThread( DWORD code ) /* [in] Exit code for this thread */ { - RtlFreeThreadActivationContextStack(); RtlExitUserThread( code ); } diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c index 56ea033..6e2ed67 100644 --- a/dlls/ntdll/thread.c +++ b/dlls/ntdll/thread.c @@ -376,6 +376,7 @@ void exit_thread( int status ) } LdrShutdownThread(); + RtlFreeThreadActivationContextStack(); pthread_sigmask( SIG_BLOCK, &server_block_set, NULL ); -- 1.7.9.5