If off-page lookup failed, there is no memory to perform

shared_mutex_init() upon.

Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Konstantin Belousov 2016-04-12 10:25:44 +00:00
parent 6573205a07
commit fe60c14631

View File

@ -476,7 +476,8 @@ check_and_init_mutex(pthread_mutex_t *mutex, struct pthread_mutex **m)
*m = __thr_pshared_offpage(mutex, 0);
if (*m == NULL)
ret = EINVAL;
shared_mutex_init(*m, NULL);
else
shared_mutex_init(*m, NULL);
} else if (__predict_false(*m <= THR_MUTEX_DESTROYED)) {
if (*m == THR_MUTEX_DESTROYED) {
ret = EINVAL;