summaryrefslogtreecommitdiff
path: root/contrib/coccinelle
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2017-02-16 14:45:13 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-02-16 14:45:13 -0800
commit0078a7598518a66c085311a11a0f25203b9ecce6 (patch)
tree899b4ab69e3658f2f8b88739e0b0e29d650c2120 /contrib/coccinelle
parentMerge branch 'ls/p4-path-encoding' (diff)
parentcocci: detect useless free(3) calls (diff)
downloadtgif-0078a7598518a66c085311a11a0f25203b9ecce6.tar.xz
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 e28213161a..c03ba737e5 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);