calloc/malloc return value checking

Greg Hudson ghudson at MIT.EDU
Fri Apr 23 11:26:02 EDT 2010


On Fri, 2010-04-23 at 09:03 -0400, Jeff Blaine wrote:
> Just throwing this out there out of curiosity (learning).
> 
> I'm seeing a lot of MIT krb5 code using:
> 
>      blah = malloc(...);  /* or calloc() */
>      if (blah == 0)
> 
> Is there an aversion to 'NULL' for some reason?

NULL is currently preferred, per:
http://k5wiki.kerberos.org/wiki/Coding_style/Practices#The_many_names_of_zero

We have an old code base which didn't have strong coding standards for
most of its lifetime; there was likely a developer or two who didn't
like using NULL.





More information about the krbdev mailing list