Skip to content

Commit ec62789

Browse files
indutnyrvagg
authored andcommitted
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 d9e934c commit ec62789

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
@@ -1001,7 +1001,7 @@ void SecureContext::LoadPKCS12(const FunctionCallbackInfo<Value>& args) {
10011001
if (cert != nullptr)
10021002
X509_free(cert);
10031003
if (extra_certs != nullptr)
1004-
sk_X509_free(extra_certs);
1004+
sk_X509_pop_free(extra_certs, X509_free);
10051005

10061006
PKCS12_free(p12);
10071007
BIO_free_all(in);

0 commit comments

Comments
 (0)