summaryrefslogtreecommitdiffstats
path: root/coccinelle/mfree.cocci
blob: 1062d0ca53707a082654167509b53a5fef4b5603 (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
/* SPDX-License-Identifier: LGPL-2.1-or-later */
@@
/* Avoid running this transformation on the mfree function itself */
position p : script:python() { p[0].current_element != "mfree" };
expression e;
@@
- free@p(e);
- return NULL;
+ return mfree(e);

@@
expression p;
@@
- free(p);
- p = NULL;
+ p = mfree(p);

@@
expression p;
@@
- if (p)
-          free(p);
+ free(p);

@@
expression p;
@@
- if (p)
-          mfree(p);
+ free(p);

@@
expression p;
@@
- mfree(p);
+ free(p);