thread: Properly clean up meta data of thread if pthread_create() fails
authorTobias Brunner <tobias@strongswan.org>
Tue, 17 Apr 2018 09:37:35 +0000 (11:37 +0200)
committerTobias Brunner <tobias@strongswan.org>
Thu, 19 Apr 2018 16:22:15 +0000 (18:22 +0200)
src/libstrongswan/threading/thread.c

index de5cbaa..bd68b5a 100644 (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;
        }