From b3c6da7f16a638b562954115c11c5fb062099dcc Mon Sep 17 00:00:00 2001 From: Gary Lin Date: Sat, 29 May 2021 16:01:25 +0800 Subject: [PATCH] efi_x509: fix an error handling in is_immediate_ca() X509cert is allocated when converting X509ca, so we should free it in case d2i_X509 fails to convert X509ca. Signed-off-by: Gary Lin --- src/efi_x509.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/efi_x509.c b/src/efi_x509.c index 6e7220d..4788740 100644 --- a/src/efi_x509.c +++ b/src/efi_x509.c @@ -141,7 +141,7 @@ is_immediate_ca (const uint8_t *cert, const uint32_t cert_size, X509ca = d2i_X509 (NULL, &ca_cert, ca_cert_size); if (X509ca == NULL) - return 0; + goto err; cert_store = X509_STORE_new (); if (cert_store == NULL)