diff --git a/lib/libkse/thread/thr_cond.c b/lib/libkse/thread/thr_cond.c index 8bf49bc155cb..b352ba3be3c9 100644 --- a/lib/libkse/thread/thr_cond.c +++ b/lib/libkse/thread/thr_cond.c @@ -152,6 +152,9 @@ _pthread_cond_destroy(pthread_cond_t *cond) /* Unlock the condition variable structure: */ THR_LOCK_RELEASE(curthread, &cv->c_lock); + /* Free the cond lock structure: */ + _lock_destroy(&cv->c_lock); + /* * Free the memory allocated for the condition * variable structure: diff --git a/lib/libkse/thread/thr_mutex.c b/lib/libkse/thread/thr_mutex.c index 2df59efee68d..8d0d76c01b5d 100644 --- a/lib/libkse/thread/thr_mutex.c +++ b/lib/libkse/thread/thr_mutex.c @@ -187,6 +187,8 @@ _pthread_mutex_init(pthread_mutex_t *mutex, MUTEX_INIT_LINK(pmutex); *mutex = pmutex; } else { + /* Free the mutex lock structure: */ + _lock_destroy(&pmutex->m_lock); free(pmutex); *mutex = NULL; } @@ -235,6 +237,10 @@ _pthread_mutex_destroy(pthread_mutex_t *mutex) * structure: */ MUTEX_ASSERT_NOT_OWNED(m); + + /* Free the mutex lock structure: */ + _lock_destroy(&m->m_lock); + free(m); } } diff --git a/lib/libpthread/thread/thr_cond.c b/lib/libpthread/thread/thr_cond.c index 8bf49bc155cb..b352ba3be3c9 100644 --- a/lib/libpthread/thread/thr_cond.c +++ b/lib/libpthread/thread/thr_cond.c @@ -152,6 +152,9 @@ _pthread_cond_destroy(pthread_cond_t *cond) /* Unlock the condition variable structure: */ THR_LOCK_RELEASE(curthread, &cv->c_lock); + /* Free the cond lock structure: */ + _lock_destroy(&cv->c_lock); + /* * Free the memory allocated for the condition * variable structure: diff --git a/lib/libpthread/thread/thr_mutex.c b/lib/libpthread/thread/thr_mutex.c index 2df59efee68d..8d0d76c01b5d 100644 --- a/lib/libpthread/thread/thr_mutex.c +++ b/lib/libpthread/thread/thr_mutex.c @@ -187,6 +187,8 @@ _pthread_mutex_init(pthread_mutex_t *mutex, MUTEX_INIT_LINK(pmutex); *mutex = pmutex; } else { + /* Free the mutex lock structure: */ + _lock_destroy(&pmutex->m_lock); free(pmutex); *mutex = NULL; } @@ -235,6 +237,10 @@ _pthread_mutex_destroy(pthread_mutex_t *mutex) * structure: */ MUTEX_ASSERT_NOT_OWNED(m); + + /* Free the mutex lock structure: */ + _lock_destroy(&m->m_lock); + free(m); } }