function_ptrs: handle SYN_NODE
[smatch.git] / validation / sm_wine_locking.c
blob0221c67f371dc52ed0ac59f3ec82479366aaeb96
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);
10 void test1(void)
12 int a;
13 int b = create_window_handle(a);
14 int c;
15 int d, e;
16 int z = frob();
18 if (d = GDI_GetObjPtr(e))
19 GDI_ReleaseObj(e);
20 if (GDI_GetObjPtr(e))
21 GDI_ReleaseObj(e);
22 EnterCriticalSection(c);
23 USER_Lock();
24 if (b) {
25 LeaveCriticalSection(c);
26 WIN_ReleasePtr(b);
28 WIN_ReleasePtr(b);
29 if (z)
30 return;
31 USER_Unlock();
32 if (!b)
33 LeaveCriticalSection(c);
36 * check-name: WINE locking
37 * check-command: smatch -p=wine --spammy sm_wine_locking.c
39 * check-output-start
40 sm_wine_locking.c:28 test1() error: double unlock 'create_window_handle:b'
41 sm_wine_locking.c:30 test1() warn: 'CriticalSection:c' is sometimes locked here and sometimes unlocked.
42 sm_wine_locking.c:33 test1() warn: inconsistent returns 'USER_Lock:'.
43 Locked on: line 30
44 Unlocked on: line 33
45 * check-output-end