Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Feb 2015 08:42:02 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r278668 - stable/10/lib/libthr/thread
Message-ID:  <201502130842.t1D8g2ph036991@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Fri Feb 13 08:42:01 2015
New Revision: 278668
URL: https://svnweb.freebsd.org/changeset/base/278668

Log:
  MFC r278313:
  Fully initialize allocated memory for the new barrier.

Modified:
  stable/10/lib/libthr/thread/thr_barrier.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libthr/thread/thr_barrier.c
==============================================================================
--- stable/10/lib/libthr/thread/thr_barrier.c	Fri Feb 13 08:40:10 2015	(r278667)
+++ stable/10/lib/libthr/thread/thr_barrier.c	Fri Feb 13 08:42:01 2015	(r278668)
@@ -86,16 +86,13 @@ _pthread_barrier_init(pthread_barrier_t 
 	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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201502130842.t1D8g2ph036991>