[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 2/5] commandtest: Resolve some coverity resource leaks



On 02/15/2013 08:54 AM, Peter Krempa wrote:
> On 02/15/13 14:17, Eric Blake wrote:
>> On 02/15/2013 02:01 AM, Peter Krempa wrote:
>>
>>>> So, one could logically believe the check could change to:
>>>>
>>>>       sa_assert(fd == -1 || (fd >= 3 && fd <= 8));
>>
>> Yes, I like that.
> 
> If I understood it correctly, the above condition won't shut up
> coverity, only sa_assert(fd == -1) does as coverity then thinks that fd
> was > 8 and thus closed. Otherwise it does not detect the magic we're
> doing later.

Yes, correct, hence the need for the "/* coverity[overwrite_var] */ tag.

Coverity will try 2 paths and only tell you when it fails. I figured
that out when going back through this exercise based on the review.
Paying close attention to trail of messages it leaves is the key - when
I first made changes to this code - I'm not sure I picked that up.

John


> 
> Peter
> 
> -- 
> libvir-list mailing list
> libvir-list redhat com
> https://www.redhat.com/mailman/listinfo/libvir-list


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]