Fix NULL argument handling in mbedtls_xxx_free() functions
Signed-off-by: Troy-Butler <squintik@outlook.com>
diff --git a/library/x509write_crt.c b/library/x509write_crt.c
index 72f5a10..56f23c9 100644
--- a/library/x509write_crt.c
+++ b/library/x509write_crt.c
@@ -46,6 +46,10 @@
void mbedtls_x509write_crt_free(mbedtls_x509write_cert *ctx)
{
+ if (ctx == NULL) {
+ return;
+ }
+
mbedtls_asn1_free_named_data_list(&ctx->subject);
mbedtls_asn1_free_named_data_list(&ctx->issuer);
mbedtls_asn1_free_named_data_list(&ctx->extensions);