From e55dea9ac44bdfbe4b08e2c040bace3280ef10cc Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Fri, 5 Feb 2016 23:13:36 -0500 Subject: [PATCH] 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: https://github.com/nodejs/node/pull/5109 Reviewed-By: James M Snell Reviewed-By: Shigeki Ohtsu --- src/node_crypto.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 0b4f8d60773ae1..b23fbce1d32e5e 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -1001,7 +1001,7 @@ void SecureContext::LoadPKCS12(const FunctionCallbackInfo& 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);