Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
Merge branch 'rs/cocci-check-free-only-null'
author
Junio C Hamano
<gitster@pobox.com>
Thu, 16 Feb 2017 22:45:13 +0000
(14:45 -0800)
committer
Junio C Hamano
<gitster@pobox.com>
Thu, 16 Feb 2017 22:45:13 +0000
(14:45 -0800)
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
contrib/coccinelle/free.cocci
patch
|
blob
|
history
raw
(from parent 1:
5a98255
)
diff --git
a/contrib/coccinelle/free.cocci
b/contrib/coccinelle/free.cocci
index e28213161a4680b266fc76a1052d728b96cbd666..c03ba737e5fafe63218c7023ce8bbd66c47f7dc5 100644
(file)
--- 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);