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

This commit is contained in:
Tobias Brunner
2018-04-19 18:22:15 +02:00
parent 69ee158e2a
commit 4af1fd59dd
+2
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;
}