Commit def75635 authored by Maxime Bellengé's avatar Maxime Bellengé Committed by Alexandre Julliard

msvcrt: Prevent a crash if TlsGetValue returns NULL in DLL_THREAD_DETACH.

parent 85128db3
......@@ -70,8 +70,11 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
case DLL_THREAD_DETACH:
/* Free TLS */
tls = TlsGetValue(msvcrt_tls_index);
HeapFree(GetProcessHeap(),0,tls->efcvt_buffer);
HeapFree(GetProcessHeap(),0,tls->wasctime_buffer);
if (tls)
{
HeapFree(GetProcessHeap(),0,tls->efcvt_buffer);
HeapFree(GetProcessHeap(),0,tls->wasctime_buffer);
}
HeapFree(GetProcessHeap(), 0, tls);
TRACE("finished thread free\n");
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment