From fd3ec5d3ba31de755b5952efa9db5334c596d5bc Mon Sep 17 00:00:00 2001 From: Jessie Murray Date: Tue, 2 Mar 2021 10:34:00 -0800 Subject: [PATCH] Fixes for PR #183 Stop logging an error when auth is disabled and free all the fields of redis_auth. --- src/conf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/conf.c b/src/conf.c index 18ddb03..2107bdb 100644 --- a/src/conf.c +++ b/src/conf.c @@ -113,7 +113,7 @@ conf_read(const char *filename) { conf->redis_auth = conf_auth_legacy(conf_string_or_envvar(json_string_value(jtmp))); } else if(json_typeof(jtmp) == JSON_ARRAY) { conf->redis_auth = conf_auth_username_password(jtmp); - } else { + } else if(json_typeof(jtmp) != JSON_NULL) { fprintf(stderr, ACL_ERROR_PREFIX "expected a string or an array of two strings" ACL_ERROR_SUFFIX); } } else if(strcmp(json_object_iter_key(kv), "http_host") == 0 && json_typeof(jtmp) == JSON_STRING) { @@ -302,6 +302,10 @@ void conf_free(struct conf *conf) { free(conf->redis_host); + if(conf->redis_auth) { + free(conf->redis_auth->username); + free(conf->redis_auth->password); + } free(conf->redis_auth); free(conf->http_host);