[PATCH] make analyzer track memory allocated by if_nameindex

Anna Zaks ganna at apple.com
Thu Oct 2 10:26:47 PDT 2014


> On Oct 2, 2014, at 2:13 AM, Daniel Fahlgren <daniel at fahlgren.se> wrote:
> 
> 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?
> 

I think your patches still need to go through pre-commit review, so we can just continue applying them.

Please, send me the updated patch (with MOK_None removed) and I'll commit it.

Thanks!
Anna.

> Cheers,
> Daniel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20141002/9f19926d/attachment.html>


More information about the cfe-commits mailing list