From: Bart Van Assche Date: Sat, 30 Apr 2011 07:27:41 +0000 (+0000) Subject: DRD: fix issues reported by the IBM static analysis tool. X-Git-Tag: svn/VALGRIND_3_7_0~518 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9d948061a1d3844c25266714cce2dbc92a19102;p=thirdparty%2Fvalgrind.git DRD: fix issues reported by the IBM static analysis tool. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11719 --- diff --git a/drd/drd_cond.c b/drd/drd_cond.c index e52cf86493..70d457e80e 100644 --- a/drd/drd_cond.c +++ b/drd/drd_cond.c @@ -300,22 +300,15 @@ void DRD_(cond_post_wait)(const Addr cond) p = DRD_(cond_get)(cond); if (!p) { - struct mutex_info* q; - q = &(DRD_(clientobj_get)(p->mutex, ClientMutex)->mutex); - { - CondDestrErrInfo cde = { - DRD_(thread_get_running_tid)(), - p->a1, - q ? q->a1 : 0, - q ? q->owner : DRD_INVALID_THREADID - }; - VG_(maybe_record_error)(VG_(get_running_tid)(), - CondDestrErr, - VG_(get_IP)(VG_(get_running_tid)()), - "condition variable has been destroyed while" - " being waited upon", - &cde); - } + CondDestrErrInfo cde = { + DRD_(thread_get_running_tid)(), cond, 0, DRD_INVALID_THREADID + }; + VG_(maybe_record_error)(VG_(get_running_tid)(), + CondDestrErr, + VG_(get_IP)(VG_(get_running_tid)()), + "condition variable has been destroyed while" + " being waited upon", + &cde); return; } diff --git a/drd/drd_semaphore.c b/drd/drd_semaphore.c index ac06179e10..5c82983229 100644 --- a/drd/drd_semaphore.c +++ b/drd/drd_semaphore.c @@ -405,18 +405,15 @@ void DRD_(semaphore_post_wait)(const DrdThreadId tid, const Addr semaphore, { sg = drd_segment_pop(p); tl_assert(sg); - if (sg) + if (p->last_sem_post_tid != tid + && p->last_sem_post_tid != DRD_INVALID_THREADID) { - if (p->last_sem_post_tid != tid - && p->last_sem_post_tid != DRD_INVALID_THREADID) - { - DRD_(thread_new_segment_and_combine_vc)(tid, sg); - } - else - DRD_(thread_new_segment)(tid); - s_semaphore_segment_creation_count++; - DRD_(sg_put)(sg); + DRD_(thread_new_segment_and_combine_vc)(tid, sg); } + else + DRD_(thread_new_segment)(tid); + s_semaphore_segment_creation_count++; + DRD_(sg_put)(sg); } }