Prevent memory leak on sem_destroy() by destroying the semaphore's

internal mutex and CV.
This commit is contained in:
deischen 2004-02-06 15:15:44 +00:00
parent aa54574435
commit eb9a5c0d3b

View File

@ -182,8 +182,11 @@ __sem_destroy(sem_t *sem)
}
_pthread_mutex_unlock(&(*sem)->lock);
if (retval == 0)
if (retval == 0) {
_pthread_mutex_destroy(&(*sem)->lock);
_pthread_cond_destroy(&(*sem)->gtzero);
sem_free(*sem);
}
return (retval);
}