From 355936dcde19c23ea6d4ccb6b87532ee38900129 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Tue, 30 Nov 2010 16:28:50 -0800 Subject: [PATCH] Implement SecureContext destructor --- src/node_crypto.cc | 1 + src/node_crypto.h | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 0ab886ef6b..d46ed1e062 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -263,6 +263,7 @@ Handle SecureContext::Close(const Arguments& args) { if (sc->ctx_ != NULL) { SSL_CTX_free(sc->ctx_); + sc->ctx_ = NULL; return True(); } diff --git a/src/node_crypto.h b/src/node_crypto.h index 9f81be6f23..817724189f 100644 --- a/src/node_crypto.h +++ b/src/node_crypto.h @@ -40,7 +40,15 @@ class SecureContext : ObjectWrap { } ~SecureContext() { - // Free up + if (ctx_) { + SSL_CTX_free(ctx_); + ctx_ = NULL; + } + + if (ca_store_) { + X509_STORE_free(ca_store_); + ca_store_ = NULL; + } } private: