From b5d9dcfa2c05820a0c73554faad5773da2abb849 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. --- 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 92cf0efda1950b..6fdf95a59dc75d 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);