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
- Explicitly document that *_free(NULL) does nothing. Fix two cases where that wasn't true. Fixes #24675. — committed to jordanbrown0/openssl by jordanbrown0 2 years ago
- Explicitly document that *_free(NULL) does nothing. Fix two cases where that wasn't true. Fixes #24675. — committed to jordanbrown0/openssl by jordanbrown0 2 years ago
- docs: document that *_free(NULL) does nothing Explicitly documents that *_free(NULL) does nothing. Fixes two cases where that wasn't true. Fixes #24675. Reviewed-by: Richard Levitte <levitte@openssl... — committed to openssl/openssl by batrla 2 years ago
- docs: document that *_free(NULL) does nothing Explicitly documents that *_free(NULL) does nothing. Fixes two cases where that wasn't true. Fixes #24675. Reviewed-by: Richard Levitte <levitte@openssl... — committed to openssl/openssl by batrla 2 years ago
- docs: document that *_free(NULL) does nothing Explicitly documents that *_free(NULL) does nothing. Fixes two cases where that wasn't true. Fixes #24675. Reviewed-by: Richard Levitte <levitte@openssl... — committed to maximmasiutin/openssl by batrla 2 years ago
- docs: document that *_free(NULL) does nothing Explicitly documents that *_free(NULL) does nothing. Fixes two cases where that wasn't true. Fixes #24675. Reviewed-by: Richard Levitte <levitte@openssl... — committed to openssl/openssl by batrla 2 years ago
- docs: document that *_free(NULL) does nothing Explicitly documents that *_free(NULL) does nothing. Fixes two cases where that wasn't true. Fixes #24675. Reviewed-by: Richard Levitte <levitte@openssl... — committed to openssl/openssl by batrla 2 years ago
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.
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