From: Alan T. DeKok Date: Mon, 1 May 2017 18:44:03 +0000 (-0400) Subject: clean up memory, too X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=abaa796b4f4a242fd979efa9047ea17b52f5655f;p=thirdparty%2Ffreeradius-server.git clean up memory, too --- diff --git a/src/main/threads.c b/src/main/threads.c index 7532377e519..635b0afbce7 100644 --- a/src/main/threads.c +++ b/src/main/threads.c @@ -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