aboutsummaryrefslogtreecommitdiff
path: root/lib/mbedtls-2.27.0/scripts/find-mem-leak.cocci
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mbedtls-2.27.0/scripts/find-mem-leak.cocci')
-rw-r--r--lib/mbedtls-2.27.0/scripts/find-mem-leak.cocci20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/mbedtls-2.27.0/scripts/find-mem-leak.cocci b/lib/mbedtls-2.27.0/scripts/find-mem-leak.cocci
new file mode 100644
index 0000000..8179e2b
--- /dev/null
+++ b/lib/mbedtls-2.27.0/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