Merge pull request #1807 from hardening/pool_leak

Fix Thread handle leak
This commit is contained in:
Marc-André Moreau 2014-04-23 19:22:15 -04:00
commit 8f24648c59

View File

@ -103,6 +103,11 @@ static void* thread_pool_work_func(void* arg)
return NULL;
}
static void threads_close(void *thread)
{
CloseHandle(thread);
}
void InitializeThreadpool(PTP_POOL pool)
{
int index;
@ -114,6 +119,7 @@ void InitializeThreadpool(PTP_POOL pool)
pool->Maximum = 500;
pool->Threads = ArrayList_New(TRUE);
pool->Threads->object.fnObjectFree = threads_close;
pool->PendingQueue = Queue_New(TRUE, -1, -1);
pool->WorkComplete = CountdownEvent_New(0);