From b3e91e9179a85320d6e4aa63780cb653ff6a5a0e Mon Sep 17 00:00:00 2001 From: rpj Date: Wed, 18 Jul 2001 07:41:47 +0000 Subject: Fix potential NULL pointer dereferences. Contributed by - "Scott McCaskill" * mutex.c (pthread_mutexattr_init): Return ENOMEM immediately and don't dereference the NULL pointer if calloc fails. (pthread_mutexattr_getpshared): Don't dereference a pointer that is possibly NULL. * barrier.c (pthread_barrierattr_init): Likewise (pthread_barrierattr_getpshared): Don't dereference a pointer that is possibly NULL. * condvar.c (pthread_condattr_getpshared): Don't dereference a pointer that is possibly NULL. --- condvar.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'condvar.c') diff --git a/condvar.c b/condvar.c index 55f0960..15f2e68 100644 --- a/condvar.c +++ b/condvar.c @@ -338,7 +338,7 @@ pthread_condattr_getpshared (const pthread_condattr_t * attr, int *pshared) * * RESULTS * 0 successfully retrieved attribute, - * EINVAL 'attr' is invalid, + * EINVAL 'attr' or 'pshared' is invalid, * * ------------------------------------------------------ */ @@ -352,7 +352,6 @@ pthread_condattr_getpshared (const pthread_condattr_t * attr, int *pshared) } else { - *pshared = PTHREAD_PROCESS_PRIVATE; result = EINVAL; } -- cgit v1.2.3