From: Tim Duesterhus Date: Sat, 23 Oct 2021 17:53:35 +0000 (+0200) Subject: DEV: coccinelle: Add realloc_leak.cocci X-Git-Tag: v2.5-dev12~29 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e6c04507d8df96b15794a4c4dc782a376c0f3051;p=thirdparty%2Fhaproxy.git 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`. --- diff --git a/dev/coccinelle/realloc_leak.cocci b/dev/coccinelle/realloc_leak.cocci new file mode 100644 index 0000000000..c201b808c0 --- /dev/null +++ b/dev/coccinelle/realloc_leak.cocci @@ -0,0 +1,6 @@ +@@ +expression E; +expression F; +@@ + +* E = realloc(E, F);