summaryrefslogtreecommitdiffstats
path: root/tools/coccinelle/xmalloc_returnval.cocci
blob: 8e0ad1027df7271f9bb35fef10cb4149ac5fc9de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/// XMALLOC, XCALLOC etc either return non-null, or abort the program.
/// Never nullcheck these.
//
// Copyright: (C) 2019 Quentin Young.  GPLv2.

virtual patch

//----------------------------------------------------------
//  For patch mode
//----------------------------------------------------------

@depends on patch@
identifier alloc;
@@

alloc = XMALLOC(...);

...

- if (alloc == NULL)
- {
- ...
- }

@depends on patch@
identifier alloc;
@@

alloc = XCALLOC(...);

...

- if (alloc == NULL)
- {
- ...
- }