diff options
Diffstat (limited to '')
-rw-r--r-- | crypto/pkcs12/p12_crt.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/crypto/pkcs12/p12_crt.c b/crypto/pkcs12/p12_crt.c index e6a2a3c55b..65d6556917 100644 --- a/crypto/pkcs12/p12_crt.c +++ b/crypto/pkcs12/p12_crt.c @@ -246,8 +246,10 @@ PKCS12_SAFEBAG *PKCS12_add_key_ex(STACK_OF(PKCS12_SAFEBAG) **pbags, /* Make a PKCS#8 structure */ if ((p8 = EVP_PKEY2PKCS8(key)) == NULL) goto err; - if (key_usage && !PKCS8_add_keyusage(p8, key_usage)) + if (key_usage && !PKCS8_add_keyusage(p8, key_usage)) { + PKCS8_PRIV_KEY_INFO_free(p8); goto err; + } if (nid_key != -1) { /* This call does not take ownership of p8 */ bag = PKCS12_SAFEBAG_create_pkcs8_encrypt_ex(nid_key, pass, -1, NULL, 0, |