On Wed, 22 Apr 2009, Rainer Gerhards wrote:

> Hi all,
>
> as Luis Fernando pointed out in a mail, free(NULL) is defined to be valid in
> C. So far, I still guarded this sequence as follows:
>
> if(p != NULL)
>   free(p);
>
> Because I had "a bad feeling" about portability. I begin to think that this
> may be overly conservative. If it is actually not needed, code cleanup may be
> useful (it is always a bad idea to do things more complex than necessary...).
>
> Comments on the issue would be appreciated.

if the standard says it's safe, I would count on it being safe.

the only question is which standard introduced this safety. if that 
standard has just been released I would carefully read the notes on it, 
but in this case I believe that it's been in the standards for a couple of 
decades.

David Lang
_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com

Reply via email to