coccinelle: add a rule to make "type" code use FREE_AND_NULL()
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
481df65f4f
commit
cf9f49ea48
@ -9,3 +9,11 @@ expression E;
|
||||
@@
|
||||
- if (!E)
|
||||
free(E);
|
||||
|
||||
@@
|
||||
type T;
|
||||
T *ptr;
|
||||
@@
|
||||
- free(ptr);
|
||||
- ptr = NULL;
|
||||
+ FREE_AND_NULL(ptr);
|
||||
|
Loading…
Reference in New Issue
Block a user