From 13def59b473a788b89c5857be0502c330d944c64 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 13 Nov 2006 15:49:48 +0000 Subject: Fix memory leak when TLSContext is reinitialised (refs #3) --- lib/server/TLSContext.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/server/TLSContext.cpp b/lib/server/TLSContext.cpp index cc125d00..49143801 100644 --- a/lib/server/TLSContext.cpp +++ b/lib/server/TLSContext.cpp @@ -61,6 +61,11 @@ TLSContext::~TLSContext() // -------------------------------------------------------------------------- void TLSContext::Initialise(bool AsServer, const char *CertificatesFile, const char *PrivateKeyFile, const char *TrustedCAsFile) { + if(mpContext != 0) + { + ::SSL_CTX_free(mpContext); + } + mpContext = ::SSL_CTX_new(AsServer?TLSv1_server_method():TLSv1_client_method()); if(mpContext == NULL) { -- cgit v1.2.3