From def7563526f17c01d61c66f684930bda92334445 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Maxime=20Belleng=C3=A9?= Date: Mon, 26 Dec 2005 12:57:06 +0100 Subject: [PATCH] msvcrt: Prevent a crash if TlsGetValue returns NULL in DLL_THREAD_DETACH. --- dlls/msvcrt/main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dlls/msvcrt/main.c b/dlls/msvcrt/main.c index a79d12f2425..779a293a767 100644 --- a/dlls/msvcrt/main.c +++ b/dlls/msvcrt/main.c @@ -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; -- 2.11.4.GIT