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

Commit

Permalink
crypto: fix leak in GetPeerCertificate
Browse files Browse the repository at this point in the history
  • Loading branch information
indutny committed Dec 3, 2012
1 parent 9d02bfb commit 51d5655
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/node_crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 51d5655

Please sign in to comment.