openssl: TYPE_free() does not document that TYPE_free(NULL) does nothing

Like the title says. It looks like the intent is that it’s never necessary to check for NULL before calling a TYPE_free() function, but the documentation for TYPE_free() doesn’t say that, and in particular for the case I’m looking at the documentation for ASN1_INTEGER_free() doesn’t say it. If it’s not documented, it’s not safe to rely on.

I’m using 3.0.13, but I checked against the web master docs.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 18 (10 by maintainers)

Commits related to this issue

Most upvoted comments

No worries about pronouns. I’ve just opened a PR. The change is ready from our side (mine, Jordan’s). The tests completed fine. They were run in CI pipeline yesterday in my forked repo.

Documentation changes, mostly yes. Confirming that every single *_free() function properly handles NULL… less so.

All our free functions should properly handle NULL. If they don’t that’s a bug IMO. I have no problem with a generic statement somewhere saying that all free functions properly handle NULL. Perhaps a good place would be in the “Library conventions” section of this page:

https://www.openssl.org/docs/manmaster/man7/ossl-guide-libraries-introduction.html