]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
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 de5cbaa216ae4c3684909419b80bcea6f937de18..bd68b5a1914402371c8c77e32b00d535517908df 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;
        }