diff options
author | AtariDreams <83477269+AtariDreams@users.noreply.github.com> | 2024-01-09 04:24:37 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-09 04:24:37 +0100 |
commit | d7d6195953f44e5028341a13ff901fde424f7542 (patch) | |
tree | 1026b2d8f0816646e3cf1406de36b13d05d35a9f /coccinelle/mfree.cocci | |
parent | simplify bitwise checking (#30722) (diff) | |
download | systemd-d7d6195953f44e5028341a13ff901fde424f7542.tar.xz systemd-d7d6195953f44e5028341a13ff901fde424f7542.zip |
cocci: merge mfree.cocci and mfree_return.cocci (#30838)
It makes sense that these should be one file instead of two, as they both involve mfree()
Diffstat (limited to 'coccinelle/mfree.cocci')
-rw-r--r-- | coccinelle/mfree.cocci | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/coccinelle/mfree.cocci b/coccinelle/mfree.cocci index 191cd626f5..1062d0ca53 100644 --- a/coccinelle/mfree.cocci +++ b/coccinelle/mfree.cocci @@ -1,7 +1,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); |