diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 1f8e6c24400..35527119eae 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -3230,7 +3230,7 @@ void WINAPI LdrShutdownThread(void) if (wm->ldr.TlsIndex != -1) call_tls_callbacks( wm->ldr.DllBase, DLL_THREAD_DETACH ); RtlAcquirePebLock(); - RemoveEntryList( &NtCurrentTeb()->TlsLinks ); + if (NtCurrentTeb()->TlsLinks.Flink) RemoveEntryList( &NtCurrentTeb()->TlsLinks ); if ((pointers = NtCurrentTeb()->ThreadLocalStoragePointer)) { for (i = 0; i < tls_module_count; i++) RtlFreeHeap( GetProcessHeap(), 0, pointers[i] );