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.
pull/5010/head
Fedor Indutny 2013-06-27 19:53:29 +02:00 committed by Ben Noordhuis
parent 8a65df9baa
commit 610269295b
1 changed files with 1 additions and 0 deletions

View File

@ -710,6 +710,7 @@ Handle<Value> SecureContext::LoadPKCS12(const Arguments& args) {
X509_STORE_add_cert(sc->ca_store_, x509);
SSL_CTX_add_client_CA(sc->ctx_, x509);
X509_free(x509);
}
EVP_PKEY_free(pkey);