fix 307082 HG false positive: pthread_cond_destroy: destruction of unknown cond var


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13332 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/helgrind/hg_main.c b/helgrind/hg_main.c
index 2da58b0..6167692 100644
--- a/helgrind/hg_main.c
+++ b/helgrind/hg_main.c
@@ -2377,6 +2377,22 @@
    cvi->nWaiters--;
 }
 
+static void evh__HG_PTHREAD_COND_INIT_POST ( ThreadId tid,
+                                             void* cond, void* cond_attr )
+{
+   CVInfo* cvi;
+
+   if (SHOW_EVENTS >= 1)
+      VG_(printf)("evh__HG_PTHREAD_COND_INIT_POST"
+                  "(ctid=%d, cond=%p, cond_attr=%p)\n", 
+                  (Int)tid, (void*)cond, (void*) cond_attr );
+
+   cvi = map_cond_to_CVInfo_lookup_or_alloc( cond );
+   tl_assert (cvi);
+   tl_assert (cvi->so);
+}
+
+
 static void evh__HG_PTHREAD_COND_DESTROY_PRE ( ThreadId tid,
                                                void* cond )
 {
@@ -4842,6 +4858,13 @@
          break;
       }
 
+      /* Thread successfully completed pthread_cond_init:
+         cond=arg[1], cond_attr=arg[2] */
+      case _VG_USERREQ__HG_PTHREAD_COND_INIT_POST:
+         evh__HG_PTHREAD_COND_INIT_POST( tid,
+                                         (void*)args[1], (void*)args[2] );
+	 break;
+
       /* cond=arg[1] */
       case _VG_USERREQ__HG_PTHREAD_COND_DESTROY_PRE:
          evh__HG_PTHREAD_COND_DESTROY_PRE( tid, (void*)args[1] );