diff options
author | davidxu <davidxu@FreeBSD.org> | 2003-06-03 02:21:01 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2003-06-03 02:21:01 +0000 |
commit | ddbadd783dbd30ec2511dad26ab3466cf7ec4c01 (patch) | |
tree | fee3eb614ec5a89673b553f6647bedd0be160e28 /lib/libkse/thread | |
parent | bf60ecbfb2d83cf558792c69ac18ac88f921df71 (diff) | |
download | FreeBSD-src-ddbadd783dbd30ec2511dad26ab3466cf7ec4c01.zip FreeBSD-src-ddbadd783dbd30ec2511dad26ab3466cf7ec4c01.tar.gz |
Free memory of internal low level lock when mutex and condition variable
are destroyed.
Submitted by: tegge
Diffstat (limited to 'lib/libkse/thread')
-rw-r--r-- | lib/libkse/thread/thr_cond.c | 3 | ||||
-rw-r--r-- | lib/libkse/thread/thr_mutex.c | 6 |
2 files changed, 9 insertions, 0 deletions
diff --git a/lib/libkse/thread/thr_cond.c b/lib/libkse/thread/thr_cond.c index 8bf49bc..b352ba3 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 2df59ef..8d0d76c 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); } } |