aboutsummaryrefslogtreecommitdiff
path: root/scripts/find-mem-leak.cocci
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/find-mem-leak.cocci')
-rw-r--r--scripts/find-mem-leak.cocci20
1 files changed, 20 insertions, 0 deletions
diff --git a/scripts/find-mem-leak.cocci b/scripts/find-mem-leak.cocci
new file mode 100644
index 000000000..8179e2b3e
--- /dev/null
+++ b/scripts/find-mem-leak.cocci
@@ -0,0 +1,20 @@
+@@
+expression x, y;
+statement S;
+@@
+ x = mbedtls_calloc(...);
+ y = mbedtls_calloc(...);
+ ...
+* if (x == NULL || y == NULL)
+ S
+
+@@
+expression x, y;
+statement S;
+@@
+ if (
+* (x = mbedtls_calloc(...)) == NULL
+ ||
+* (y = mbedtls_calloc(...)) == NULL
+ )
+ S