Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
coccinelle: add a rule to make "expression" code use FREE_AND_NULL()
author
Ævar Arnfjörð Bjarmason
<avarab@gmail.com>
Thu, 15 Jun 2017 23:15:47 +0000
(23:15 +0000)
committer
Junio C Hamano
<gitster@pobox.com>
Fri, 16 Jun 2017 19:44:04 +0000
(12:44 -0700)
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 <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/coccinelle/free.cocci
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
6a83d90
)
diff --git
a/contrib/coccinelle/free.cocci
b/contrib/coccinelle/free.cocci
index 35fb992621ff7c718d91258f4b8ac18a28db17ab..f2d97e755b891aac988121212a3bb2188b3a150a 100644
(file)
--- 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);