Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

Commit 42f926e

Browse files
committed
crypto: fix memory leak in LoadPKCS12
X509_STORE_add_cert increment reference of passed `x509` cert, `X509_free` must be called to avoid memory leak. This is a back-port of commit c1db1ec from the master branch.
1 parent ccad4c7 commit 42f926e

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

src/node_crypto.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,7 @@ Handle<Value> SecureContext::LoadPKCS12(const Arguments& args) {
640640

641641
X509_STORE_add_cert(sc->ca_store_, x509);
642642
SSL_CTX_add_client_CA(sc->ctx_, x509);
643+
X509_free(x509);
643644
}
644645

645646
EVP_PKEY_free(pkey);

0 commit comments

Comments
 (0)