1 int create_window_handle(int x);
   2 void WIN_ReleasePtr(int x);
   3 void EnterCriticalSection(int x);
   4 void LeaveCriticalSection(int x);
   5 void USER_Lock(void);
   6 void USER_Unlock(void);
   7 int GDI_GetObjPtr(int x);
   8 void GDI_ReleaseObj(int x);
   9 
  10 int a, b, c, d, e, z;
  11 
  12 void test1(void)
  13 {
  14         b = create_window_handle(a);
  15         z = frob();
  16 
  17         if (d = GDI_GetObjPtr(e))
  18                 GDI_ReleaseObj(e);
  19         if (GDI_GetObjPtr(e))
  20                 GDI_ReleaseObj(e);
  21         EnterCriticalSection(c);
  22         USER_Lock();
  23         if (b) {
  24                 LeaveCriticalSection(c);
  25                 WIN_ReleasePtr(b);
  26         }
  27         WIN_ReleasePtr(b);
  28         if (z)
  29                 return;
  30         USER_Unlock();
  31         if (!b)
  32                 LeaveCriticalSection(c);
  33 }
  34 /*
  35  * check-name: WINE locking
  36  * check-command: smatch -p=wine --spammy sm_wine_locking.c
  37  *
  38  * check-output-start
  39 sm_wine_locking.c:27 test1() error: double unlock 'create_window_handle:b'
  40 sm_wine_locking.c:29 test1() warn: 'CriticalSection:c' is sometimes locked here and sometimes unlocked.
  41 sm_wine_locking.c:32 test1() warn: inconsistent returns 'USER_Lock:'.
  42   Locked on:   line 29
  43   Unlocked on: line 32
  44  * check-output-end
  45  */