[Skiboot] [PATCH 4/7] secvar/backend: fix a memory leak in get_pkcs7

Daniel Axtens dja at axtens.net
Thu Jul 1 22:41:03 AEST 2021


We need to actually free the pkcs7 structure, not just pass it to
mbedtls_pkcs7_free().

Signed-off-by: Daniel Axtens <dja at axtens.net>
---
 libstb/secvar/backend/edk2-compat-process.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libstb/secvar/backend/edk2-compat-process.c b/libstb/secvar/backend/edk2-compat-process.c
index edbb588899c8..f6831f1f7ccf 100644
--- a/libstb/secvar/backend/edk2-compat-process.c
+++ b/libstb/secvar/backend/edk2-compat-process.c
@@ -452,6 +452,7 @@ static mbedtls_pkcs7* get_pkcs7(const struct efi_variable_authentication_2 *auth
 
 out:
 	mbedtls_pkcs7_free(pkcs7);
+	free(pkcs7);
 	pkcs7 = NULL;
 	return pkcs7;
 }
-- 
2.30.2



More information about the Skiboot mailing list