From 9f779d351f6da185c2a36755b5dccb535d40b1de 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 d970420a6e..4d93dd4cb0 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_);