[openssl-users] [openssl-dev] Is X509_free(NULL) ok?

Ken Goldman kgoldman at us.ibm.com
Fri Dec 22 14:13:02 UTC 2017


On 12/22/2017 8:06 AM, Salz, Rich via openssl-users wrote:
> Our intent is that all FREE functions can handle NULL.  If you find
> things missing or undocumented, please open an issue on GitHub.
> Thanks!

It would be great if that was documented for all _free() functions.  I 
currently always code

	if (ptr!= NULL) free(ptr);

because the behavior isn't defined.

BTW, "can handle" should explicitly say what happens.  Perhaps use the C 
library text, which says:

	If ptr is NULL, no operation is performed.






More information about the openssl-users mailing list