diff options
-rw-r--r-- | contrib/coccinelle/free.cocci | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/contrib/coccinelle/free.cocci b/contrib/coccinelle/free.cocci index 4490069df9..f2d97e755b 100644 --- a/contrib/coccinelle/free.cocci +++ b/contrib/coccinelle/free.cocci @@ -11,8 +11,16 @@ expression E; free(E); @@ +type T; +T *ptr; +@@ +- free(ptr); +- ptr = NULL; ++ FREE_AND_NULL(ptr); + +@@ expression E; @@ - free(E); -+ FREE_AND_NULL(E); - E = NULL; ++ FREE_AND_NULL(E); |