thread: Properly clean up meta data of thread if pthread_create() fails

This commit is contained in:
Tobias Brunner 2018-04-17 11:37:35 +02:00
parent 69ee158e2a
commit 4af1fd59dd
1 changed files with 2 additions and 0 deletions

View File

@ -348,6 +348,8 @@ thread_t *thread_create(thread_main_t main, void *arg)
{
DBG1(DBG_LIB, "failed to create thread!");
this->mutex->lock(this->mutex);
this->terminated = TRUE;
this->detached_or_joined = TRUE;
thread_destroy(this);
return NULL;
}