Browse Source

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>
v6
Ben Noordhuis 8 years ago
parent
commit
9f779d351f
  1. 3
      src/node_crypto.cc

3
src/node_crypto.cc

@ -770,9 +770,8 @@ void SecureContext::AddCRL(const FunctionCallbackInfo<Value>& args) {
PEM_read_bio_X509_CRL(bio, nullptr, CryptoPemCallback, nullptr); PEM_read_bio_X509_CRL(bio, nullptr, CryptoPemCallback, nullptr);
if (crl == nullptr) { if (crl == nullptr) {
return env->ThrowError("Failed to parse CRL");
BIO_free_all(bio); BIO_free_all(bio);
return; return env->ThrowError("Failed to parse CRL");
} }
X509_STORE* cert_store = SSL_CTX_get_cert_store(sc->ctx_); X509_STORE* cert_store = SSL_CTX_get_cert_store(sc->ctx_);

Loading…
Cancel
Save