From 01280a0b29ff91f123eea0a2de7375c7c562125d Mon Sep 17 00:00:00 2001 From: Ben Noordhuis <info@bnoordhuis.nl> 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 <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Fedor Indutny <fedor@indutny.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Rod Vagg <rod@vagg.org> --- 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 7e351d6b75499c..c5f5871617c222 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -787,9 +787,8 @@ void SecureContext::AddCRL(const FunctionCallbackInfo<Value>& 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_);