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

Ken Goldman kgoldman at us.ibm.com
Fri Dec 22 15:15:46 UTC 2017


On 12/22/2017 9:59 AM, Salz, Rich via openssl-dev wrote:
> 
> I think we fixed all such cases in 1.1.0, all *_free()
> functions should handle NULL. I don't think we backported to changes
> to 1.0.2.
> 
> Yes, and we fixed the documentation.  I backported all/most of them
> to 1.0.2 to make cherry-picking easier.  I don’t know if I changed
> the docs.

So it's guaranteed for 1.1, mostly guaranteed for recent 1.0.2, but not
guaranteed for older 1.0.2.

If that's the case, I suspect it's just as easy to leave the

	if (ptr != NULL)

in the code, as to code an ifdef for version < 1.1.

~~

I also think it would be good to backport all to 1.0.2.  If the 
documentation says it's OK in 1.1, and the coder uses the 1.1 API,
the end user may get crashes if they compile against 1.0.2.

	




More information about the openssl-dev mailing list