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.
This commit is contained in:
Aurelien DARRAGON 2024-05-14 16:18:05 +02:00
parent 2a1bf99923
commit db47471155

View File

@ -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;