diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 03:50:42 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 03:50:42 +0000 |
commit | 78e9bb837c258ac0ec7712b3d612cc2f407e731e (patch) | |
tree | f515d16b6efd858a9aeb5b0ef5d6f90bf288283d /coccinelle/mfree.cocci | |
parent | Adding debian version 255.5-1. (diff) | |
download | systemd-78e9bb837c258ac0ec7712b3d612cc2f407e731e.tar.xz systemd-78e9bb837c258ac0ec7712b3d612cc2f407e731e.zip |
Merging upstream version 256.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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 191cd62..1062d0c 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); |