From aa18209c9928bcb1f72b01f823594663953d710a Mon Sep 17 00:00:00 2001 From: Jacob Barthelmeh Date: Wed, 2 Mar 2022 09:59:21 -0700 Subject: [PATCH] free buffer since pkey struct makes its own copy --- src/ssl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ssl.c b/src/ssl.c index 162c64f40..7085094b8 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -63271,13 +63271,14 @@ int wolfSSL_PKCS12_parse(WC_PKCS12* pkcs12, const char* psw, } } #endif /* HAVE_ECC */ + if (pk != NULL) + XFREE(pk, heap, DYNAMIC_TYPE_PKCS); if (ret != 0) { /* if is in fail state and no PKEY then fail */ wolfSSL_X509_free(*cert); *cert = NULL; if (ca != NULL) { wolfSSL_sk_X509_pop_free(*ca, NULL); *ca = NULL; } wolfSSL_EVP_PKEY_free(*pkey); *pkey = NULL; - XFREE(pk, heap, DYNAMIC_TYPE_PKCS); WOLFSSL_MSG("Bad PKCS12 key format"); return WOLFSSL_FAILURE; }