Skip to content

Commit

Permalink
crypto: fix memory leak in LoadPKCS12
Browse files Browse the repository at this point in the history
`sk_X509_pop_free` should be used instead of `sk_X509_free` to free all
items in queue too, not just the queue itself.

PR-URL: #5109
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Shigeki Ohtsu <[email protected]>
  • Loading branch information
indutny authored and rvagg committed Feb 9, 2016
1 parent 131873d commit e55dea9
Showing 1 changed file with 1 addition and 1 deletion.
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);

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

0 comments on commit e55dea9

Please sign in to comment.