add: if (wPtr->thrPtr != NULL) { NsCleanupThread(wPtr->thrPtr); wPtr->thrPtr = NULL; }
context: DllMain(HANDLE hModule, DWORD why, LPVOID lpReserved){    WinThread *wPtr;    switch (why) {    case DLL_PROCESS_ATTACH:	tlskey = TlsAlloc();	if (tlskey == 0xFFFFFFFF) {	    return FALSE;	}	break;    case DLL_THREAD_DETACH:    case DLL_PROCESS_DETACH:	wPtr = TlsGetValue(tlskey);	if (wPtr != NULL) {	    if (!CloseHandle(wPtr->event)) {		NsThreadFatal("DllMain", "CloseHandle", GetLastError());	    }	    if (!TlsSetValue(tlskey, NULL)) {		NsThreadFatal("DllMain", "TlsSetValue", GetLastError());	    }	    free(wPtr);	}	if (why == DLL_PROCESS_DETACH && !TlsFree(tlskey)) {	    NsThreadFatal("DllMain", "TlsFree", GetLastError());	}	break;    }    return TRUE;}