From 2ce29e032b6d474c4e819597e1fb690e29e735d6 Mon Sep 17 00:00:00 2001 From: Wen Hui Date: Mon, 8 Nov 2021 15:23:31 -0500 Subject: [PATCH] Sentinel tls memory leak (#9753) There was a memory leak when tls is used in Sentinels. The memory leak is noticed when some of the replicas are offline. --- src/sentinel.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sentinel.c b/src/sentinel.c index 56c70ffec..02cf931ab 100644 --- a/src/sentinel.c +++ b/src/sentinel.c @@ -2348,7 +2348,10 @@ static int instanceLinkNegotiateTLS(redisAsyncContext *context) { SSL *ssl = SSL_new(redis_tls_client_ctx ? redis_tls_client_ctx : redis_tls_ctx); if (!ssl) return C_ERR; - if (redisInitiateSSL(&context->c, ssl) == REDIS_ERR) return C_ERR; + if (redisInitiateSSL(&context->c, ssl) == REDIS_ERR) { + SSL_free(ssl); + return C_ERR; + } #endif return C_OK; }