mirror of
https://github.com/haproxy/haproxy.git
synced 2026-05-28 04:12:17 -04:00
35 lines
413 B
Text
35 lines
413 B
Text
|
|
// find calls to malloc
|
||
|
|
@call@
|
||
|
|
expression ptr;
|
||
|
|
position p;
|
||
|
|
@@
|
||
|
|
|
||
|
|
ptr@p = malloc(...);
|
||
|
|
|
||
|
|
// find ok calls to malloc
|
||
|
|
@ok@
|
||
|
|
expression ptr;
|
||
|
|
position call.p;
|
||
|
|
@@
|
||
|
|
|
||
|
|
ptr@p = malloc(...);
|
||
|
|
... when != ptr
|
||
|
|
(
|
||
|
|
(ptr == NULL || ...)
|
||
|
|
|
|
||
|
|
(ptr == 0 || ...)
|
||
|
|
|
|
||
|
|
(ptr != NULL || ...)
|
||
|
|
|
|
||
|
|
(ptr != 0 || ...)
|
||
|
|
)
|
||
|
|
|
||
|
|
// fix bad calls to malloc
|
||
|
|
@depends on !ok@
|
||
|
|
expression ptr;
|
||
|
|
position call.p;
|
||
|
|
@@
|
||
|
|
|
||
|
|
ptr@p = malloc(...);
|
||
|
|
+ if (ptr == NULL) return;
|