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 <jasnell@gmail.com>
Reviewed-By: Shigeki Ohtsu <ohtsu@iij.ad.jp>
  • Loading branch information
indutny authored and Myles Borins committed Mar 2, 2016
1 parent 689e1fa commit b3050a5
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 @@ -1009,7 +1009,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 b3050a5

Please sign in to comment.