From: Bart Van Assche Date: Mon, 7 Jul 2008 08:17:55 +0000 (+0000) Subject: Out-of-spec use of POSIX barriers could make drd crash -- fixed this. X-Git-Tag: svn/VALGRIND_3_4_0~364 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=70055557a0d2d8226e3b9a42838ebefc379a7f9d;p=thirdparty%2Fvalgrind.git Out-of-spec use of POSIX barriers could make drd crash -- fixed this. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8374 --- diff --git a/drd/drd_barrier.c b/drd/drd_barrier.c index 762418039a..fac3eb73c0 100644 --- a/drd/drd_barrier.c +++ b/drd/drd_barrier.c @@ -84,6 +84,7 @@ static void barrier_thread_initialize(struct barrier_thread_info* const p, /** Deallocate the memory that was allocated in barrier_thread_initialize(). */ static void barrier_thread_destroy(struct barrier_thread_info* const p) { + tl_assert(p); sg_put(p->sg[0]); sg_put(p->sg[1]); } @@ -409,8 +410,11 @@ void barrier_thread_delete(const DrdThreadId tid) struct barrier_thread_info* q; const UWord word_tid = tid; q = VG_(OSetGen_Remove)(p->oset, &word_tid); - barrier_thread_destroy(q); - VG_(OSetGen_FreeNode)(p->oset, q); + if (q) + { + barrier_thread_destroy(q); + VG_(OSetGen_FreeNode)(p->oset, q); + } } }