Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ba6eb8a

Browse filesBrowse files
skomskiFishrock123
authored andcommitted
crypto: fix memory leak in ECDH::SetPrivateKey
PR-URL: #2375 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
1 parent 6a16368 commit ba6eb8a
Copy full SHA for ba6eb8a

File tree

Expand file treeCollapse file tree

1 file changed

+5
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-1
lines changed
Open diff view settings
Collapse file

‎src/node_crypto.cc‎

Copy file name to clipboardExpand all lines: src/node_crypto.cc
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4568,8 +4568,12 @@ void ECDH::SetPrivateKey(const FunctionCallbackInfo<Value>& args) {
45684568
if (priv == nullptr)
45694569
return env->ThrowError("Failed to convert Buffer to BN");
45704570

4571-
if (!EC_KEY_set_private_key(ecdh->key_, priv))
4571+
int result = EC_KEY_set_private_key(ecdh->key_, priv);
4572+
BN_free(priv);
4573+
4574+
if (!result) {
45724575
return env->ThrowError("Failed to convert BN to a private key");
4576+
}
45734577
}
45744578

45754579

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.