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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

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

OpenSSL - User mailing list
Our intent is that all FREE functions can handle NULL.  If you find things missing or undocumented, please open an issue on GitHub.  Thanks!
 

--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
Reply | Threaded
Open this post in threaded view
|

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

Ken Goldman-2
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.




--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
Reply | Threaded
Open this post in threaded view
|

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

OpenSSL - User mailing list
> if (ptr!= NULL) free(ptr);
 
That shouldn’t be necessary for OpenSSL.  If you find places where it is, please open an issue.
 
➢ BTW, "can handle" should explicitly say what happens.  Perhaps use the C
    library text, which says:
   
    If ptr is NULL, no operation is performed.
 
That is the wording we use.

--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
Reply | Threaded
Open this post in threaded view
|

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

Kurt Roeckx
On Fri, Dec 22, 2017 at 09:30:19AM -0500, Ken Goldman wrote:

> On 12/22/2017 9:24 AM, Salz, Rich via openssl-users wrote:
> > > if (ptr!= NULL) free(ptr);
> > That shouldn’t be necessary for OpenSSL.  If you find places where it is, please open an issue.
>
> OK.  I'll mention a few, but it's a global issue.
>
> The code may handle NULL.  However, conservative users won't go by what the
> code happens to do today.  We have to go by the API documentation, which is
> the contract between the library and the user.  If the API is silent, we
> cautiously assume it's not guaranteed, and can change in the future.

So feel free to document it as being able to handle NULL.


Kurt

--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users