We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4b61cb0 commit 12ab8cfCopy full SHA for 12ab8cf
1 file changed
src/node_crypto.cc
@@ -4570,8 +4570,12 @@ void ECDH::SetPrivateKey(const FunctionCallbackInfo<Value>& args) {
4570
if (priv == nullptr)
4571
return env->ThrowError("Failed to convert Buffer to BN");
4572
4573
- if (!EC_KEY_set_private_key(ecdh->key_, priv))
+ int result = EC_KEY_set_private_key(ecdh->key_, priv);
4574
+ BN_free(priv);
4575
+
4576
+ if (!result) {
4577
return env->ThrowError("Failed to convert BN to a private key");
4578
+ }
4579
}
4580
4581
0 commit comments