From ddbadd783dbd30ec2511dad26ab3466cf7ec4c01 Mon Sep 17 00:00:00 2001 From: davidxu Date: Tue, 3 Jun 2003 02:21:01 +0000 Subject: Free memory of internal low level lock when mutex and condition variable are destroyed. Submitted by: tegge --- lib/libpthread/thread/thr_mutex.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/libpthread/thread/thr_mutex.c') diff --git a/lib/libpthread/thread/thr_mutex.c b/lib/libpthread/thread/thr_mutex.c index 2df59ef..8d0d76c 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); } } -- cgit v1.1