Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
cocci: detect useless free(3) calls
author
René Scharfe
<l.s.r@web.de>
Sat, 11 Feb 2017 13:58:44 +0000
(14:58 +0100)
committer
Junio C Hamano
<gitster@pobox.com>
Sat, 11 Feb 2017 19:29:12 +0000
(11:29 -0800)
Add a semantic patch for removing checks that cause free(3) to only be
called with a NULL pointer, as that must be a programming mistake.
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/coccinelle/free.cocci
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
3b9e3c2
)
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);