mirror of
https://github.com/FRRouting/frr.git
synced 2025-04-30 21:47:15 +02:00
tools: Add coccinelle script for checking against XMALLOC/XCALLOC NULLs
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
This commit is contained in:
parent
4953391b45
commit
63f7a3b910
17
tools/coccinelle/xcalloc-xmalloc.cocci
Normal file
17
tools/coccinelle/xcalloc-xmalloc.cocci
Normal 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 ...;
|
Loading…
Reference in a new issue