From: Ulrich Drepper Date: Wed, 12 Jan 2000 11:57:45 +0000 (+0000) Subject: (pthread_free): Free read/write lock lists. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0f226bf382fc94a9ec6742059bd7608030375568;p=thirdparty%2Fglibc.git (pthread_free): Free read/write lock lists. --- diff --git a/linuxthreads/manager.c b/linuxthreads/manager.c index 417e32260b9..8c9a8bcdd89 100644 --- a/linuxthreads/manager.c +++ b/linuxthreads/manager.c @@ -500,6 +500,8 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr, static void pthread_free(pthread_descr th) { pthread_handle handle; + pthread_readlock_info *iter, *next; + ASSERT(th->p_exited); /* Make the handle invalid */ handle = thread_handle(th->p_tid); @@ -512,6 +514,23 @@ static void pthread_free(pthread_descr th) #endif /* One fewer threads in __pthread_handles */ __pthread_handles_num--; + + /* Destroy read lock list, and list of free read lock structures. + If the former is not empty, it means the thread exited while + holding read locks! */ + + for (iter = th->p_readlock_list; iter != NULL; iter = next) + { + next = iter->pr_next; + free(iter); + } + + for (iter = th->p_readlock_free; iter != NULL; iter = next) + { + next = iter->pr_next; + free(iter); + } + /* If initial thread, nothing to free */ if (th == &__pthread_initial_thread) return; if (!th->p_userstack)