diff --git a/Crypto/src/EVPPKey.cpp b/Crypto/src/EVPPKey.cpp index 4f1263af7..5db3033bd 100644 --- a/Crypto/src/EVPPKey.cpp +++ b/Crypto/src/EVPPKey.cpp @@ -73,14 +73,15 @@ EVPPKey::EVPPKey(const PKCS12Container& cont): EVPPKey(cont.getKey()) void pushBuildParamBignum(OSSL_PARAM_BLD* paramBld, const char* key, const std::vector& bytes) { - BIGNUM* bignum = nullptr; - if (!(bignum = BN_bin2bn(bytes.data(), (int)bytes.size(), nullptr))) + BIGNUM* pBigNum = nullptr; + if (!(pBigNum = BN_bin2bn(bytes.data(), (int)bytes.size(), nullptr))) { std::string msg = "pushBuildParamBignum(): BN_bin2bn()\n"; throw OpenSSLException(getError(msg)); } - OSSL_PARAM_BLD_push_BN(paramBld, key, bignum); + OSSL_PARAM_BLD_push_BN(paramBld, key, pBigNum); + BN_clear_free(pBigNum); }