Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
crypto: fix memory leak in LoadPKCS12
`sk_X509_pop_free` should be used instead of `sk_X509_free` to free all
items in queue too, not just the queue itself.
  • Loading branch information
indutny committed Feb 6, 2016
commit b5d9dcfa2c05820a0c73554faad5773da2abb849
2 changes: 1 addition & 1 deletion src/node_crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,7 @@ void SecureContext::LoadPKCS12(const FunctionCallbackInfo<Value>& args) {
if (cert != nullptr)
X509_free(cert);
if (extra_certs != nullptr)
sk_X509_free(extra_certs);
sk_X509_pop_free(extra_certs, X509_free);
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unrelated bugfix for a memory leak, not sure if I should submit it separately. It won't have a test case anyway.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might make sense to put as two commits for back-porting purposes... I don't see why they couldn't both come in on this PR though

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, force pushed.


PKCS12_free(p12);
BIO_free_all(in);
Expand Down