From db4747115570fd1cfcd7eb6c827d7b75e28cdccb Mon Sep 17 00:00:00 2001 From: Aurelien DARRAGON Date: Tue, 14 May 2024 16:18:05 +0200 Subject: [PATCH] MINOR: log/backend: always free parsing hints in resolve_logger() Since resolve_logger() always resolves logger target (even when error occurs), we must take care of freeing parsing hints because free_logger() won't try to do it if target RESOLVED flag is set on the target. This isn't considered as a bug because resolve_logger(), being a postparsing check, will make haproxy immediately exit upon fatal error in haproxy.c, but it's better to ensure that everything will be properly freed if we decide to perform a clean exit upon postparsing checks error in the future. --- src/log.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/log.c b/src/log.c index 862e0299d..a6d074915 100644 --- a/src/log.c +++ b/src/log.c @@ -1427,18 +1427,15 @@ int resolve_logger(struct logger *logger, char **msg) if (!be) { memprintf(msg, "uses unknown log backend '%s'", target->be_name); err_code |= ERR_ALERT | ERR_FATAL; - goto end; } else if (be->mode != PR_MODE_SYSLOG) { memprintf(msg, "uses incompatible log backend '%s'", target->be_name); err_code |= ERR_ALERT | ERR_FATAL; - goto end; } ha_free(&target->be_name); /* backend is resolved and will replace name hint */ target->be = be; } - end: target->flags |= LOG_TARGET_FL_RESOLVED; return err_code;