summaryrefslogtreecommitdiff
path: root/contrib/coccinelle/xcalloc.cocci
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/coccinelle/xcalloc.cocci')
-rw-r--r--contrib/coccinelle/xcalloc.cocci10
1 files changed, 10 insertions, 0 deletions
diff --git a/contrib/coccinelle/xcalloc.cocci b/contrib/coccinelle/xcalloc.cocci
new file mode 100644
index 0000000000..c291011607
--- /dev/null
+++ b/contrib/coccinelle/xcalloc.cocci
@@ -0,0 +1,10 @@
+@@
+type T;
+T *ptr;
+expression n;
+@@
+ xcalloc(
++ n,
+ \( sizeof(T) \| sizeof(*ptr) \)
+- , n
+ )