crypto: fix memory leak in PublicKeyCipher::Cipher
authorKarl Skomski <karl@skomski.com>
Fri, 14 Aug 2015 12:28:39 +0000 (14:28 +0200)
committerBen Noordhuis <info@bnoordhuis.nl>
Mon, 17 Aug 2015 19:23:11 +0000 (21:23 +0200)
PR-URL: https://github.com/nodejs/node/pull/2375
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
src/node_crypto.cc

index 6bde146..04f5b0f 100644 (file)
@@ -3933,6 +3933,8 @@ bool PublicKeyCipher::Cipher(const char* key_pem,
   fatal = false;
 
  exit:
+  if (x509 != nullptr)
+    X509_free(x509);
   if (pkey != nullptr)
     EVP_PKEY_free(pkey);
   if (bp != nullptr)