diff options
author | kib <kib@FreeBSD.org> | 2015-02-13 08:42:01 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2015-02-13 08:42:01 +0000 |
commit | 000b391a47f8de7b1cfe82f67a6cb98778a747d6 (patch) | |
tree | 21c78723cc674cf56640bcadc3999657bdf4112a | |
parent | a6e5411cef55e691940945353a00fc4b0d3776d3 (diff) | |
download | FreeBSD-src-000b391a47f8de7b1cfe82f67a6cb98778a747d6.zip FreeBSD-src-000b391a47f8de7b1cfe82f67a6cb98778a747d6.tar.gz |
MFC r278313:
Fully initialize allocated memory for the new barrier.
-rw-r--r-- | lib/libthr/thread/thr_barrier.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/libthr/thread/thr_barrier.c b/lib/libthr/thread/thr_barrier.c index 86f880e..10b6346 100644 --- a/lib/libthr/thread/thr_barrier.c +++ b/lib/libthr/thread/thr_barrier.c @@ -86,16 +86,13 @@ _pthread_barrier_init(pthread_barrier_t *barrier, if (barrier == NULL || count <= 0) return (EINVAL); - bar = malloc(sizeof(struct pthread_barrier)); + bar = calloc(1, sizeof(struct pthread_barrier)); if (bar == NULL) return (ENOMEM); _thr_umutex_init(&bar->b_lock); _thr_ucond_init(&bar->b_cv); - bar->b_cycle = 0; - bar->b_waiters = 0; bar->b_count = count; - bar->b_refcount = 0; *barrier = bar; return (0); |