From ca400f824b88ec9dc3b7df8b36413c0adf9248ee Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 28 Jun 2017 14:55:39 -0700 Subject: Revert "coccinelle: add a rule to make "expression" code use FREE_AND_NULL()" This reverts commit f8bb4631fb7c97dd9f035a89404fa6beab5867df; it is reported that older Coccinelle (1.0.4 from Debian) still needs "type T" rule, not just the "expression E" one. --- contrib/coccinelle/free.cocci | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 @@ -10,9 +10,17 @@ expression E; - if (!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); -- cgit v1.2.1