Free memory of internal low level lock when mutex and condition variable

are destroyed.

Submitted by: tegge
This commit is contained in:
David Xu 2003-06-03 02:21:01 +00:00
parent 795d7dc093
commit a4c69f224b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=115761
4 changed files with 18 additions and 0 deletions

View File

@ -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:

View File

@ -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);
}
}

View File

@ -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:

View File

@ -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);
}
}