Hi,

On 09/10/18 01:31, Gert Doering wrote:
> Hi,
> 
> On Mon, Oct 08, 2018 at 07:35:54PM +0300, Lev Stipakov wrote:
>>  out:
>> -    free(cmdline);
>> +    if (cmdline)
>> +    {
>> +        free(cmdline);
>> +    }
> 
> Do we have something in our styleguides related to these constructs?
> 
> Since free(NULL) is well-defined and valid(!), the if() check is not
> needed at all and just adding extra lines on screen.
> 
> I'm sure we had this discussion before, but couldn't find something
> where we wrote down how and why we do things.  We do have parts of 
> the code that *does* "if(ptr) { free(ptr); }" checks, and others that
> don't...  for example, AsyncPipeOp() on failure to malloc() "handles".
> 

I don't think we have any guideline, but I agree we should just remove
the surrounding check, because, as you said, it is well defined behaviour.

Maybe somebody could make this consistent across the codebase.


Regards,

-- 
Antonio Quartulli

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to