Commit afe774e0 authored by Erwan Tulou's avatar Erwan Tulou

Win32(core): do not duplicate handle

Unlike _endthread and ExitThread, _endthreadex doesn't close the handle.
It is therefore up to the caller to close it. Hence no need for an extra
handle duplication (that mostly amounted to a memory leak when the normal
 path was used, i.e normal return from thread with implicit _endthreadex)
parent 99f71e5a
......@@ -553,15 +553,7 @@ int vlc_clone (vlc_thread_t *p_handle, void * (*entry) (void *), void *data,
goto error;
}
/* Thread closes the handle when exiting, duplicate it here
* to be on the safe side when joining. */
if (!DuplicateHandle (GetCurrentProcess (), hThread,
GetCurrentProcess (), p_handle, 0, FALSE,
DUPLICATE_SAME_ACCESS))
{
CloseHandle (hThread);
goto error;
}
*p_handle = hThread;
#else
vlc_thread_t th = malloc (sizeof (*th));
......
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