Skip to content

Commit 1b83d12

Browse files
avargitster
authored andcommitted
coccinelle: add a rule to make "expression" code use FREE_AND_NULL()
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6a83d90 commit 1b83d12

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

contrib/coccinelle/free.cocci

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,10 @@ T *ptr;
1717
- free(ptr);
1818
- ptr = NULL;
1919
+ FREE_AND_NULL(ptr);
20+
21+
@@
22+
expression E;
23+
@@
24+
- free(E);
25+
- E = NULL;
26+
+ FREE_AND_NULL(E);

0 commit comments

Comments
 (0)