crypto: fix leak in GetPeerCertificate

This commit is contained in:
Fedor Indutny 2012-12-01 22:26:40 +04:00
parent 9d02bfbc25
commit 51d5655efa

View File

@ -1532,6 +1532,15 @@ Handle<Value> 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));