tools: Add coccinelle script for checking against XMALLOC/XCALLOC NULLs

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
This commit is contained in:
Donatas Abraitis 2021-06-29 15:16:01 +03:00
parent 4953391b45
commit 63f7a3b910

View file

@ -0,0 +1,17 @@
// No need checking against NULL for XMALLOC/XCALLOC.
// If that happens, we have more problems with memory.
@@
type T;
T *ptr;
@@
ptr =
(
XCALLOC(...)
|
XMALLOC(...)
)
...
- if (ptr == NULL)
- return ...;