[PATCH] make analyzer track memory allocated by if_nameindex

Daniel Fahlgren daniel at fahlgren.se
Thu Oct 2 02:13:49 PDT 2014


Hi,

On Wed, 2014-10-01 at 18:00 -0700, Anna Zaks wrote:
> +    MOK_None,
> Do we need this one?

No, that is a left over after some old code structure. Sorry.

> +    if (Family == AF_Malloc && CheckFree) {
> +    if (Family == AF_Malloc && CheckAlloc) {
> 
> A possible micro optimization would be to check the family once for the
> common two cases. Also, note that "ChecksEnabled[CK_MallocOptimistic]"
> most commonly evaluates to false.

> if (Family == AF_Malloc) {
>     if (CheckFree) {
>       if ()       ...
>     } else {
>       assert(CheckAlloc); 
>       if ()       ...
>     }
>     if (!ChecksEnabled[CK_MallocOptimistic])
>       return false;
> }

I've tried that but the amount of nested if-statements and conditions
looked too cluttered. Also that example is slightly wrong since in some
cases we wish do check for both Free and Allocate functions, not just
one kind.

> Do you have commit access?

No I do not, but perhaps it is time that I apply for it?

Cheers,
Daniel




More information about the cfe-commits mailing list