summaryrefslogtreecommitdiff
path: root/contrib/coccinelle
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-02-16 22:45:13 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-02-16 22:45:13 (GMT)
commit0078a7598518a66c085311a11a0f25203b9ecce6 (patch)
tree899b4ab69e3658f2f8b88739e0b0e29d650c2120 /contrib/coccinelle
parent5a98255dec1578cc6dc3f25e85d7ea96028687b7 (diff)
parentec6cd14c7a869b32776c1d3387afc93f369aea62 (diff)
downloadgit-0078a7598518a66c085311a11a0f25203b9ecce6.zip
git-0078a7598518a66c085311a11a0f25203b9ecce6.tar.gz
git-0078a7598518a66c085311a11a0f25203b9ecce6.tar.bz2
Merge branch 'rs/cocci-check-free-only-null'
A new coccinelle rule that catches a check of !pointer before the pointer is free(3)d, which most likely is a bug. * rs/cocci-check-free-only-null: cocci: detect useless free(3) calls
Diffstat (limited to 'contrib/coccinelle')
-rw-r--r--contrib/coccinelle/free.cocci6
1 files changed, 6 insertions, 0 deletions
diff --git a/contrib/coccinelle/free.cocci b/contrib/coccinelle/free.cocci
index e282131..c03ba73 100644
--- a/contrib/coccinelle/free.cocci
+++ b/contrib/coccinelle/free.cocci
@@ -3,3 +3,9 @@ expression E;
@@
- if (E)
free(E);
+
+@@
+expression E;
+@@
+- if (!E)
+ free(E);