malloc/calloc return value NULL check

Baesken, Matthias matthias.baesken at sap.com
Fri Jul 11 12:57:43 UTC 2025


Hi, when playing around with the  GCC static analyzer  ( https://developers.redhat.com/articles/2022/04/12/state-static-analysis-gcc-12-compiler )   I noticed
a lot of complaints about  missing  NULL checks of  malloc/calloc  return values in the code base.

While we check these return values for NULL at a lot of places in the codebase,  it is not done always.
Should we do it always  (except 3rd party code probably where we do not want to have large diffs to upstream) ?

Or is it considered not important enough  to do it always?

Best regards, Matthias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/build-dev/attachments/20250711/d512361a/attachment.htm>


More information about the build-dev mailing list