git.99rst.org
/
git.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
| inline |
side by side
(parent:
6a83d90
)
coccinelle: add a rule to make "expression" code use FREE_AND_NULL()
author
Ævar Arnfjörð Bjarmason
<redacted>
Thu, 15 Jun 2017 23:15:47 +0000
(23:15 +0000)
committer
Junio C Hamano
<redacted>
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 <redacted>
Signed-off-by: Junio C Hamano <redacted>
contrib/coccinelle/free.cocci
patch
|
blob
|
history
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);
git clone https://git.99rst.org/PROJECT