From e6c04507d8df96b15794a4c4dc782a376c0f3051 Mon Sep 17 00:00:00 2001 From: Tim Duesterhus Date: Sat, 23 Oct 2021 19:53:35 +0200 Subject: [PATCH] DEV: coccinelle: Add realloc_leak.cocci This coccinelle patch finds locations where the return value of `realloc()` is assigned to the pointer passed to `realloc()`. This calls will leak memory if `realloc()` returns `NULL`. --- dev/coccinelle/realloc_leak.cocci | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 dev/coccinelle/realloc_leak.cocci diff --git a/dev/coccinelle/realloc_leak.cocci b/dev/coccinelle/realloc_leak.cocci new file mode 100644 index 000000000..c201b808c --- /dev/null +++ b/dev/coccinelle/realloc_leak.cocci @@ -0,0 +1,6 @@ +@@ +expression E; +expression F; +@@ + +* E = realloc(E, F);