From e4e2464970c48040d2bc7a2b8dfe93e31f37ce84 Mon Sep 17 00:00:00 2001 From: kib Date: Thu, 5 Mar 2015 09:00:27 +0000 Subject: 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. --- lib/libstdthreads/thrd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/libstdthreads/thrd.c') 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); } -- cgit v1.1