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()
This commit is contained in:
AtariDreams 2024-01-08 22:24:37 -05:00 committed by GitHub
parent 5ba46b99f7
commit d7d6195953
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 9 deletions

View File

@ -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);

View File

@ -1,9 +0,0 @@
/* 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);