Andrew's git
/
gitweb.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
commit
grep
author
committer
pickaxe
?
re
Merge branch 'rs/apply-avoid-over-reading'
[gitweb.git]
/
contrib
/
coccinelle
/
free.cocci
diff --git
a/contrib/coccinelle/free.cocci
b/contrib/coccinelle/free.cocci
index c03ba737e5fafe63218c7023ce8bbd66c47f7dc5..f2d97e755b891aac988121212a3bb2188b3a150a 100644
(file)
--- a/
contrib/coccinelle/free.cocci
+++ b/
contrib/coccinelle/free.cocci
@@
-9,3
+9,18
@@
expression E;
@@
- if (!E)
free(E);
+
+@@
+type T;
+T *ptr;
+@@
+- free(ptr);
+- ptr = NULL;
++ FREE_AND_NULL(ptr);
+
+@@
+expression E;
+@@
+- free(E);
+- E = NULL;
++ FREE_AND_NULL(E);