Fixed use after free.

This commit is contained in:
Armin Novak 2014-11-16 15:21:13 +01:00
parent 77a3c0ca4a
commit 51cb07b0f4

View File

@ -426,6 +426,7 @@ HANDLE CreateRemoteThread(HANDLE hProcess, LPSECURITY_ATTRIBUTES lpThreadAttribu
VOID ExitThread(DWORD dwExitCode) VOID ExitThread(DWORD dwExitCode)
{ {
DWORD rc;
pthread_t tid = pthread_self(); pthread_t tid = pthread_self();
if (!thread_list) if (!thread_list)
@ -460,10 +461,11 @@ VOID ExitThread(DWORD dwExitCode)
ListDictionary_Unlock(thread_list); ListDictionary_Unlock(thread_list);
set_event(thread); set_event(thread);
rc = thread->dwExitCode;
if (thread->detached || !thread->started) if (thread->detached || !thread->started)
cleanup_handle(thread); cleanup_handle(thread);
pthread_exit((void*) (size_t) thread->dwExitCode); pthread_exit((void*) (size_t) rc);
} }
} }