Signed-off-by: Paul Gofman pgofman@codeweavers.com --- dlls/kernelbase/thread.c | 2 +- dlls/ntdll/loader.c | 3 ++- dlls/ntdll/ntdll.spec | 1 + dlls/ntdll/thread.c | 10 ++++++++++ include/winternl.h | 1 + 5 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/dlls/kernelbase/thread.c b/dlls/kernelbase/thread.c index 0bfef62a7da..f2b746856e1 100644 --- a/dlls/kernelbase/thread.c +++ b/dlls/kernelbase/thread.c @@ -1022,7 +1022,7 @@ void WINAPI DECLSPEC_HOTPATCH DeleteFiber( LPVOID fiber_ptr ) RtlExitUserThread( 1 ); } RtlFreeUserStack( fiber->stack_allocation ); - HeapFree( GetProcessHeap(), 0, fiber->fls_slots ); + RtlProcessFlsData( fiber->fls_slots, 3 ); HeapFree( GetProcessHeap(), 0, fiber ); }
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 20bc3f977d1..cd27ce5658b 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -3255,7 +3255,8 @@ void WINAPI LdrShutdownThread(void) for (i = 0; i < tls_module_count; i++) RtlFreeHeap( GetProcessHeap(), 0, pointers[i] ); RtlFreeHeap( GetProcessHeap(), 0, pointers ); } - RtlFreeHeap( GetProcessHeap(), 0, NtCurrentTeb()->FlsSlots ); + RtlProcessFlsData( NtCurrentTeb()->FlsSlots, 3 ); + NtCurrentTeb()->FlsSlots = NULL; RtlFreeHeap( GetProcessHeap(), 0, NtCurrentTeb()->TlsExpansionSlots ); NtCurrentTeb()->TlsExpansionSlots = NULL; RtlReleasePebLock(); diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index ce9f6281d5d..6f44f499825 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -874,6 +874,7 @@ @ stdcall RtlPopFrame(ptr) @ stdcall RtlPrefixString(ptr ptr long) @ stdcall RtlPrefixUnicodeString(ptr ptr long) +@ stdcall RtlProcessFlsData(ptr long) @ stub RtlPropertySetNameToGuid @ stub RtlProtectHeap @ stdcall RtlPushFrame(ptr) diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c index 716ef3b61d0..57292043582 100644 --- a/dlls/ntdll/thread.c +++ b/dlls/ntdll/thread.c @@ -343,3 +343,13 @@ NTSTATUS WINAPI DECLSPEC_HOTPATCH RtlFlsGetValue( ULONG index, void **data )
return STATUS_SUCCESS; } + + +/*********************************************************************** + * RtlProcessFlsData (NTDLL.@) + */ +void WINAPI DECLSPEC_HOTPATCH RtlProcessFlsData( void *teb_fls_data, ULONG flags ) +{ + if (flags & 2) + RtlFreeHeap( GetProcessHeap(), 0, teb_fls_data ); +} diff --git a/include/winternl.h b/include/winternl.h index 82328167c9e..75324635ed7 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -3480,6 +3480,7 @@ NTSYSAPI NTSTATUS WINAPI RtlPinAtomInAtomTable(RTL_ATOM_TABLE,RTL_ATOM); NTSYSAPI void WINAPI RtlPopFrame(TEB_ACTIVE_FRAME*); NTSYSAPI BOOLEAN WINAPI RtlPrefixString(const STRING*,const STRING*,BOOLEAN); NTSYSAPI BOOLEAN WINAPI RtlPrefixUnicodeString(const UNICODE_STRING*,const UNICODE_STRING*,BOOLEAN); +NTSYSAPI void WINAPI RtlProcessFlsData(void*,ULONG); NTSYSAPI void WINAPI RtlPushFrame(TEB_ACTIVE_FRAME*); NTSYSAPI NTSTATUS WINAPI RtlQueryActivationContextApplicationSettings(DWORD,HANDLE,const WCHAR*,const WCHAR*,WCHAR*,SIZE_T,SIZE_T*); NTSYSAPI NTSTATUS WINAPI RtlQueryAtomInAtomTable(RTL_ATOM_TABLE,RTL_ATOM,ULONG*,ULONG*,WCHAR*,ULONG*);