Skip to content

Commit

Permalink
src: fix memory leak introduced in 34febfb
Browse files Browse the repository at this point in the history
Fix leaking the BIO in the error path.  Introduced in commit 34febfb
("crypto: fix handling of root_cert_store").

PR-URL: #9604
Refs: #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>
  • Loading branch information
bnoordhuis authored and MylesBorins committed Jan 31, 2017
1 parent 4e1a5a7 commit cfa1b5a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/node_crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -770,9 +770,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_);
Expand Down

0 comments on commit cfa1b5a

Please sign in to comment.