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>master
parent
dfa33e60b0
commit
5f4382247a
7
ssl.c
7
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)
|
||||
|
|
Loading…
Reference in New Issue