summaryrefslogtreecommitdiffstats
path: root/contrib/coccinelle/tests/free.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/coccinelle/tests/free.c')
-rw-r--r--contrib/coccinelle/tests/free.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/contrib/coccinelle/tests/free.c b/contrib/coccinelle/tests/free.c
new file mode 100644
index 0000000..96d4abc
--- /dev/null
+++ b/contrib/coccinelle/tests/free.c
@@ -0,0 +1,11 @@
+int use_FREE_AND_NULL(int *v)
+{
+ free(*v);
+ *v = NULL;
+}
+
+int need_no_if(int *v)
+{
+ if (v)
+ free(v);
+}