summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2015-03-05 09:00:27 +0000
committerkib <kib@FreeBSD.org>2015-03-05 09:00:27 +0000
commite4e2464970c48040d2bc7a2b8dfe93e31f37ce84 (patch)
tree90e1c2b42f8ae41a23c3cc26c7e190694d4710f2 /lib
parent5b322e75c920bb1f61538feaaed5d3492eb0e3f5 (diff)
downloadFreeBSD-src-e4e2464970c48040d2bc7a2b8dfe93e31f37ce84.zip
FreeBSD-src-e4e2464970c48040d2bc7a2b8dfe93e31f37ce84.tar.gz
MFC r279318:
Check that the pointer to the thread return value is not NULL before dereferencing. NULL is allowed by C11 and must be handled.
Diffstat (limited to 'lib')
-rw-r--r--lib/libstdthreads/thrd.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libstdthreads/thrd.c b/lib/libstdthreads/thrd.c
index f0ce55a..b0e36ef 100644
--- a/lib/libstdthreads/thrd.c
+++ b/lib/libstdthreads/thrd.c
@@ -108,7 +108,8 @@ thrd_join(thrd_t thr, int *res)
if (pthread_join(thr, &value_ptr) != 0)
return (thrd_error);
- *res = (intptr_t)value_ptr;
+ if (res != NULL)
+ *res = (intptr_t)value_ptr;
return (thrd_success);
}
OpenPOWER on IntegriCloud