[rsyslog] advise request: free(NULL)

Rainer Gerhards rgerhards at hq.adiscon.com
Wed Apr 22 13:52:47 CEST 2009


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.

Thanks,
Rainer



More information about the rsyslog mailing list