diff options
Diffstat (limited to 'tools/coccinelle/free.cocci')
| -rw-r--r-- | tools/coccinelle/free.cocci | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/tools/coccinelle/free.cocci b/tools/coccinelle/free.cocci new file mode 100644 index 0000000000..03799e1908 --- /dev/null +++ b/tools/coccinelle/free.cocci @@ -0,0 +1,45 @@ +@@ +expression E; +@@ +- if (E) +( + free(E); +| + commit_list_free(E); +) + +@@ +expression E; +@@ +- if (!E) +( + free(E); +| + commit_list_free(E); +) + +@@ +expression E; +@@ +- free(E); ++ FREE_AND_NULL(E); +- E = NULL; + +@@ +expression E; +@@ +- if (E) +- { + commit_list_free(E); + E = NULL; +- } + +@@ +expression E; +statement S; +@@ +- if (E) { ++ if (E) + S + commit_list_free(E); +- } |
