From 3fc0ff63594ee5413c682f9830871dbbc2641b86 Mon Sep 17 00:00:00 2001 From: IPredator Date: Mon, 7 Apr 2014 18:59:41 +0700 Subject: [PATCH] Fix Client Mode memory Leak NOTE: Manual patch of https://github.com/bumptech/stud/pull/107 --- stud.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/stud.c b/stud.c index 18eeb4f..2c6d19d 100644 --- a/stud.c +++ b/stud.c @@ -657,8 +657,13 @@ SSL_CTX *make_ctx(const char *pemfile) { SSL_CTX_use_tack_files(ctx, CONFIG->TACK_FILE, CONFIG->TACK_BREAK_SIGS_FILE, CONFIG->TACK_PIN_ACTIVATION); #endif + if (CONFIG->PMODE == SSL_CLIENT) { + /* Disable internal cache of openssl: session reuse cause memory leak + in SSL_SESS_CACHE_CLIENT mode */ + SSL_CTX_set_session_cache_mode(ctx, SSL_SESS_CACHE_OFF); + } #ifdef USE_SHARED_CACHE - if (CONFIG->SHARED_CACHE) { + else if (CONFIG->SHARED_CACHE) { if (shared_context_init(ctx, CONFIG->SHARED_CACHE) < 0) { ERR("Unable to alloc memory for shared cache.\n"); exit(1);