> -----Original Message-----
> From: [email protected] [mailto:rsyslog-
> [email protected]] On Behalf Of [email protected]
> Sent: Wednesday, April 22, 2009 2:36 PM
> To: rsyslog-users
> Subject: Re: [rsyslog] advise request: free(NULL)
> 
> 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.

>From what I have seen, it was part of the original ANSI C standard, but it
looks like it was one decade ago that it somehow reliably went into
mainstream compilers. So it looks like we can drop it (get rid of an old
habit ;)).

But please anybody who sees a potential issue please speak up!

Rainer

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

Reply via email to