Skip to content

Commit 3fc0ff6

Browse files
author
IPredator
committed
Fix Client Mode memory Leak
NOTE: Manual patch of bumptech#107
1 parent af21f63 commit 3fc0ff6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

stud.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,8 +657,13 @@ SSL_CTX *make_ctx(const char *pemfile) {
657657
SSL_CTX_use_tack_files(ctx, CONFIG->TACK_FILE, CONFIG->TACK_BREAK_SIGS_FILE, CONFIG->TACK_PIN_ACTIVATION);
658658
#endif
659659

660+
if (CONFIG->PMODE == SSL_CLIENT) {
661+
/* Disable internal cache of openssl: session reuse cause memory leak
662+
in SSL_SESS_CACHE_CLIENT mode */
663+
SSL_CTX_set_session_cache_mode(ctx, SSL_SESS_CACHE_OFF);
664+
}
660665
#ifdef USE_SHARED_CACHE
661-
if (CONFIG->SHARED_CACHE) {
666+
else if (CONFIG->SHARED_CACHE) {
662667
if (shared_context_init(ctx, CONFIG->SHARED_CACHE) < 0) {
663668
ERR("Unable to alloc memory for shared cache.\n");
664669
exit(1);

0 commit comments

Comments
 (0)