summaryrefslogtreecommitdiff
path: root/ssl.c
diff options
context:
space:
mode:
authorHans Zandbelt <hans.zandbelt@zmartzone.eu>2021-04-11 18:49:38 +0200
committerHans Zandbelt <hans.zandbelt@zmartzone.eu>2021-04-11 18:49:38 +0200
commit5f4382247a0074d2080921956cd9784bbd1824c2 (patch)
tree00d522ec2474b050f9476cb4bec0d2c5f43dbe47 /ssl.c
parentdfa33e60b07c13328133a16065d88d171a2a61d4 (diff)
improve SSL leak fix redis/hiredis#896
Free SSL object when redisSSLConnect fails but avoid doing that for callers of redisInitiateSSL who are supposed to manager their own SSL object. Signed-off-by: Hans Zandbelt <hans.zandbelt@zmartzone.eu>
Diffstat (limited to 'ssl.c')
-rw-r--r--ssl.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/ssl.c b/ssl.c
index c856bbc..c581f63 100644
--- a/ssl.c
+++ b/ssl.c
@@ -351,7 +351,6 @@ static int redisSSLConnect(redisContext *c, SSL *ssl) {
}
hi_free(rssl);
- SSL_free(ssl);
return REDIS_ERR;
}
@@ -393,7 +392,11 @@ int redisInitiateSSLWithContext(redisContext *c, redisSSLContext *redis_ssl_ctx)
}
}
- return redisSSLConnect(c, ssl);
+ if (redisSSLConnect(c, ssl) != REDIS_OK) {
+ goto error;
+ }
+
+ return REDIS_OK;
error:
if (ssl)