From 1b83d1251edbfb49feb84c0c32d241a63e2118a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Thu, 15 Jun 2017 23:15:47 +0000 Subject: coccinelle: add a rule to make "expression" code use FREE_AND_NULL() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A follow-up to the existing "type" rule added in an earlier change. This catches some occurrences that are missed by the previous rule. Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano diff --git a/contrib/coccinelle/free.cocci b/contrib/coccinelle/free.cocci index 35fb992..f2d97e7 100644 --- a/contrib/coccinelle/free.cocci +++ b/contrib/coccinelle/free.cocci @@ -17,3 +17,10 @@ T *ptr; - free(ptr); - ptr = NULL; + FREE_AND_NULL(ptr); + +@@ +expression E; +@@ +- free(E); +- E = NULL; ++ FREE_AND_NULL(E); -- cgit v0.10.2-6-g49f6