summaryrefslogtreecommitdiffstats
path: root/lib/libthr/thread/thr_mutex.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2016-04-12 10:25:44 +0000
committerkib <kib@FreeBSD.org>2016-04-12 10:25:44 +0000
commite472ae2aec6936a875835e91508cefe7a262a853 (patch)
treef32ba2ed509bf36dc71214df0150c460d6957bf0 /lib/libthr/thread/thr_mutex.c
parent1a0a52e9a644d2edcbcbc322a1ed4df0e3904532 (diff)
downloadFreeBSD-src-e472ae2aec6936a875835e91508cefe7a262a853.zip
FreeBSD-src-e472ae2aec6936a875835e91508cefe7a262a853.tar.gz
If off-page lookup failed, there is no memory to perform
shared_mutex_init() upon. Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'lib/libthr/thread/thr_mutex.c')
-rw-r--r--lib/libthr/thread/thr_mutex.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libthr/thread/thr_mutex.c b/lib/libthr/thread/thr_mutex.c
index 28fd9ee..f75ea6f 100644
--- a/lib/libthr/thread/thr_mutex.c
+++ b/lib/libthr/thread/thr_mutex.c
@@ -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;
OpenPOWER on IntegriCloud