Free memory of internal low level lock when mutex and condition variable
are destroyed. Submitted by: tegge
This commit is contained in:
parent
795d7dc093
commit
a4c69f224b
@ -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:
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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:
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user