Skip to content

Commit cf9f49e

Browse files
avargitster
authored andcommitted
coccinelle: add a rule to make "type" code use FREE_AND_NULL()
Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 481df65 commit cf9f49e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

contrib/coccinelle/free.cocci

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,11 @@ expression E;
99
@@
1010
- if (!E)
1111
free(E);
12+
13+
@@
14+
type T;
15+
T *ptr;
16+
@@
17+
- free(ptr);
18+
- ptr = NULL;
19+
+ FREE_AND_NULL(ptr);

0 commit comments

Comments
 (0)