]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
DRD: fix issues reported by the IBM static analysis tool.
authorBart Van Assche <bvanassche@acm.org>
Sat, 30 Apr 2011 07:27:41 +0000 (07:27 +0000)
committerBart Van Assche <bvanassche@acm.org>
Sat, 30 Apr 2011 07:27:41 +0000 (07:27 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11719

drd/drd_cond.c
drd/drd_semaphore.c

index e52cf86493c6e575d723dfbb874e99a551c3eaff..70d457e80e1b748ad4e9a7407f945ba6926cabcb 100644 (file)
@@ -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;
    }
 
index ac06179e10d6839e6244d4b2b69eb288bef93cba..5c8298322902a0f5877ea0b5173376fda85018c4 100644 (file)
@@ -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);
    }
 }