]> git.ipfire.org Git - thirdparty/systemd.git/blob - coccinelle/mfree.cocci
test: make coverage runs happy with capsule@.service
[thirdparty/systemd.git] / coccinelle / mfree.cocci
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 @@
3 /* Avoid running this transformation on the mfree function itself */
4 position p : script:python() { p[0].current_element != "mfree" };
5 expression e;
6 @@
7 - free@p(e);
8 - return NULL;
9 + return mfree(e);
10
11 @@
12 expression p;
13 @@
14 - free(p);
15 - p = NULL;
16 + p = mfree(p);
17
18 @@
19 expression p;
20 @@
21 - if (p)
22 - free(p);
23 + free(p);
24
25 @@
26 expression p;
27 @@
28 - if (p)
29 - mfree(p);
30 + free(p);
31
32 @@
33 expression p;
34 @@
35 - mfree(p);
36 + free(p);