diff --git a/src/node_crypto.cc b/src/node_crypto.cc index b85e5e57e7..7e168b6f34 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -1339,6 +1339,15 @@ Handle Connection::GetPeerCertificate(const Arguments& args) { (void) BIO_reset(bio); } + if (pkey != NULL) { + EVP_PKEY_free(pkey); + pkey = NULL; + } + if (rsa != NULL) { + RSA_free(rsa); + rsa = NULL; + } + ASN1_TIME_print(bio, X509_get_notBefore(peer_cert)); BIO_get_mem_ptr(bio, &mem); info->Set(valid_from_symbol, String::New(mem->data, mem->length));