diff options
author | rpj <rpj> | 2001-07-18 07:41:47 +0000 |
---|---|---|
committer | rpj <rpj> | 2001-07-18 07:41:47 +0000 |
commit | b3e91e9179a85320d6e4aa63780cb653ff6a5a0e (patch) | |
tree | 90a054b0533f577c43cd7d76fd24f4690d913786 /barrier.c | |
parent | 024172be698e329e76c95e32c29ca5023fc036ac (diff) |
Fix potential NULL pointer dereferences.
Contributed by - "Scott McCaskill" <scott@magruder.org>
* 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.
Diffstat (limited to 'barrier.c')
-rw-r--r-- | barrier.c | 16 |
1 files changed, 6 insertions, 10 deletions
@@ -221,13 +221,14 @@ pthread_barrierattr_init (pthread_barrierattr_t * attr) { result = ENOMEM; } - - ba->pshared = PTHREAD_PROCESS_PRIVATE; - + else + { + ba->pshared = PTHREAD_PROCESS_PRIVATE; + } + *attr = ba; - + return (result); - } /* pthread_barrierattr_init */ @@ -270,12 +271,9 @@ pthread_barrierattr_destroy (pthread_barrierattr_t * attr) *attr = NULL; free (ba); - - result = 0; } return (result); - } /* pthread_barrierattr_destroy */ @@ -330,12 +328,10 @@ pthread_barrierattr_getpshared (const pthread_barrierattr_t * attr, } else { - *pshared = PTHREAD_PROCESS_PRIVATE; result = EINVAL; } return (result); - } /* pthread_barrierattr_getpshared */ |