Hi, I think it should be documented, but currently the two supported branches are ok with NULL: - following from IMPLEMENT_ASN1_FUNCTIONS(X509), for both openssl-1.0.2n and 1.1.0g: - 1.0.2n ends up in asn1_item_combine_free() - 1.1.0g ends up in asn1_item_embed_free() - in both cases an explicit check is done for NULL.
See https://github.com/openssl/openssl/blob/OpenSSL_1_1_0g/crypto/asn1/tasn_fre.c#L36 and https://github.com/openssl/openssl/blob/OpenSSL_1_0_2n/crypto/asn1/tasn_fre.c#L86 Mischa On Thu, Dec 21, 2017 at 12:58 AM, Viktor Dukhovni <openssl-us...@dukhovni.org> wrote: > > >> On Dec 20, 2017, at 5:50 PM, Ray Satiro via openssl-dev >> <openssl-dev@openssl.org> wrote: >> >> 'm trying to figure out whether it's supported to call X509_free(NULL) >> in 1.0.2 and beyond. It's not documented what action occurs when the >> pointer is null. Also generally speaking is it supported to call openssl >> free functions with null pointers? > > > All ASN.1 objects (such as X509 *) that are implemented via > IMPLEMENT_ASN1_FUNCTIONS(typename) are freed by ASN1_item_free(), > which I believe handles NULL inputs. > > If you don't see immediate crashes on trying it, you can use it > on NULL inputs with confidence that this is intentional and not > going to change. > > -- > -- > Viktor. > > -- > openssl-dev mailing list > To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev -- openssl-dev mailing list To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev