diff options
author | Tomas Mraz <tomas@openssl.org> | 2021-10-11 15:03:47 +0200 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2021-10-12 16:46:16 +0200 |
commit | a7731e5f8bd01d0aed5f262f7815a75269045c32 (patch) | |
tree | 3d87773f50cc8f75d1c09f9b6080c9dd82e563c6 /crypto | |
parent | 14fd5a0d55652a7539c66df18d1120baed42248e (diff) |
ctrl_params_translate: Fix leak of BN_CTX
Also add a missing allocation failure check.
Fixes #16788
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/16804)
(cherry picked from commit 922422119df1f6aabd2a15e6e4108d98b6143adf)
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/evp/ctrl_params_translate.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/crypto/evp/ctrl_params_translate.c b/crypto/evp/ctrl_params_translate.c index 88945e13e6..b17ce3cbf9 100644 --- a/crypto/evp/ctrl_params_translate.c +++ b/crypto/evp/ctrl_params_translate.c @@ -1595,10 +1595,13 @@ static int get_payload_public_key(enum state state, const EC_GROUP *ecg = EC_KEY_get0_group(eckey); const EC_POINT *point = EC_KEY_get0_public_key(eckey); + if (bnctx == NULL) + return 0; ctx->sz = EC_POINT_point2buf(ecg, point, POINT_CONVERSION_COMPRESSED, &buf, bnctx); ctx->p2 = buf; + BN_CTX_free(bnctx); break; } return 0; |