svn commit: r279631 - stable/10/lib/libstdthreads

Konstantin Belousov kib at FreeBSD.org
Thu Mar 5 09:00:28 UTC 2015


Author: kib
Date: Thu Mar  5 09:00:27 2015
New Revision: 279631
URL: https://svnweb.freebsd.org/changeset/base/279631

Log:
  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.

Modified:
  stable/10/lib/libstdthreads/thrd.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libstdthreads/thrd.c
==============================================================================
--- stable/10/lib/libstdthreads/thrd.c	Thu Mar  5 08:53:10 2015	(r279630)
+++ stable/10/lib/libstdthreads/thrd.c	Thu Mar  5 09:00:27 2015	(r279631)
@@ -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);
 }
 


More information about the svn-src-stable mailing list