From 570de44897b64fd06ac1f4af8a408b1b8cbd65eb Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Mon, 14 Nov 2016 13:39:40 +0100 Subject: [PATCH] src: fix memory leak introduced in 34febfbf4 Fix leaking the BIO in the error path. Introduced in commit 34febfbf4 ("crypto: fix handling of root_cert_store"). PR-URL: https://github.com/nodejs/node/pull/9604 Refs: https://github.com/nodejs/node/pull/9409 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Fedor Indutny Reviewed-By: James M Snell Reviewed-By: Jeremiah Senkpiel Reviewed-By: Michael Dawson Reviewed-By: Rod Vagg --- src/node_crypto.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/node_crypto.cc b/src/node_crypto.cc index dcb0d38c47d346..3fd71012351583 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -770,9 +770,8 @@ void SecureContext::AddCRL(const FunctionCallbackInfo& args) { PEM_read_bio_X509_CRL(bio, nullptr, CryptoPemCallback, nullptr); if (crl == nullptr) { - return env->ThrowError("Failed to parse CRL"); BIO_free_all(bio); - return; + return env->ThrowError("Failed to parse CRL"); } X509_STORE* cert_store = SSL_CTX_get_cert_store(sc->ctx_);