]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
clean up memory, too
authorAlan T. DeKok <aland@freeradius.org>
Mon, 1 May 2017 18:44:03 +0000 (14:44 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 1 May 2017 18:44:03 +0000 (14:44 -0400)
src/main/threads.c

index 7532377e5198b2378eadf7f1224e4ac41bf658e6..635b0afbce758a159b42fc11273ec159de3512e4 100644 (file)
@@ -935,7 +935,7 @@ int thread_pool_init(void)
 void thread_pool_stop(void)
 {
 #ifndef WITH_GCD
-       THREAD_HANDLE *thread;
+       THREAD_HANDLE *thread, *next;
 
        if (!pool_initialized) return;
 
@@ -952,8 +952,10 @@ void thread_pool_stop(void)
        /*
         *      Join and free all threads.
         */
-       for (thread = thread_pool.thread_head; thread; thread = thread->next) {
+       for (thread = thread_pool.thread_head; thread; thread = next) {
+               next = thread->next;
                pthread_join(thread->pthread_id, NULL);
+               talloc_free(thread);
        }
 
 #  ifdef WNOHANG