summaryrefslogtreecommitdiff
path: root/tools/coccinelle/free.cocci
blob: 03799e190828fa01258020f9b18f8d603dfccb66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
@@
expression E;
@@
- if (E)
(
  free(E);
|
  commit_list_free(E);
)

@@
expression E;
@@
- if (!E)
(
  free(E);
|
  commit_list_free(E);
)

@@
expression E;
@@
- free(E);
+ FREE_AND_NULL(E);
- E = NULL;

@@
expression E;
@@
- if (E)
- {
  commit_list_free(E);
  E = NULL;
- }

@@
expression E;
statement S;
@@
- if (E) {
+ if (E)
  S
  commit_list_free(E);
- }