cms: free PKEY_CTX

Preventing a memory leak.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
(Merged from https://github.com/openssl/openssl/pull/15731)
master
Pauli 2 years ago
parent 8dff167dfe
commit dfb0b8d63a

@ -38,6 +38,7 @@ static EVP_PKEY *pkey_type2param(int ptype, const void *pval,
goto err;
}
OSSL_DECODER_CTX_free(ctx);
return pkey;
} else if (ptype == V_ASN1_OBJECT) {
const ASN1_OBJECT *poid = pval;
char groupname[OSSL_MAX_NAME_SIZE];
@ -53,12 +54,12 @@ static EVP_PKEY *pkey_type2param(int ptype, const void *pval,
}
if (EVP_PKEY_paramgen(pctx, &pkey) <= 0)
goto err;
} else {
ERR_raise(ERR_LIB_CMS, CMS_R_DECODE_ERROR);
goto err;
EVP_PKEY_CTX_free(pctx);
return pkey;
}
return pkey;
ERR_raise(ERR_LIB_CMS, CMS_R_DECODE_ERROR);
return NULL;
err:
EVP_PKEY_free(pkey);

Loading…
Cancel
Save