Julia Lawall <[email protected]> writes:
> On Mon, 21 Mar 2011, Anders Wegge Keller wrote:
>
>> Hi,
>>
>> I've tried going over our codebase with the following script, to find
>> places where memory allocations are not checked before usage:
>>
>> @@
>> identifier ptr, fld;
>> @@
>> * ptr = dMemAlloc(...)
>>
>> ... when != (ptr != NULL)
>>
>> * ptr->fld
>
> Try:
>
> @@
> identifier ptr, fld;
> @@
> (
> (ptr = dMemAlloc(...)) == NULL
> |
> * ptr = dMemAlloc(...)
>
> ... when != (ptr != NULL)
>
> * ptr->fld
> )
>
I see the intention, but unfortunately it doesn't parse:
init_defs_builtins: /usr//share/coccinelle/standard.h
89 92
Fatal error: exception Failure("minus: parse error:
= File "/pro/awj/Linux/Coccinelle/Unchecked_dMemAlloc.cocci", line 9, column
1, charpos = 89
around = '...', whole content = ... when != (ptr != NULL)
")
--
/Wegge
Leder efter redundant peering af dk.*,linux.debian.*
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)