Skip to content

Commit a7955d5

Browse files
indutnyMyles Borins
authored and
Myles Borins
committed
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. PR-URL: #5109 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Shigeki Ohtsu <[email protected]>
1 parent 5d9c1cf commit a7955d5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/node_crypto.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,7 @@ void SecureContext::LoadPKCS12(const FunctionCallbackInfo<Value>& args) {
10091009
if (cert != nullptr)
10101010
X509_free(cert);
10111011
if (extra_certs != nullptr)
1012-
sk_X509_free(extra_certs);
1012+
sk_X509_pop_free(extra_certs, X509_free);
10131013

10141014
PKCS12_free(p12);
10151015
BIO_free_all(in);

0 commit comments

Comments
 (0)