This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

crypto: fix leak in GetPeerCertificate

  • Loading branch information...
indutny committed Dec 1, 2012
1 parent e5649d4 commit 276245d26f43d0eb9e5a78a046eab1f3a429365a
Showing with 9 additions and 0 deletions.
  1. +9 −0 src/node_crypto.cc
View
@@ -1339,6 +1339,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));

0 comments on commit 276245d

Please sign in to comment.