flt_precheck_instance() passes a message to the ->parse() callback of
the filter classes, which may allocate it with memprintf() to report an
error. The message was reported with ha_alert() but never released, so
it leaked each time a "filter-config" instance failed to be parsed, for
instance with "filter-config trace id t1 bogus-option", as reported by
ASAN.
This only happens on configuration errors, which are fatal at boot, but
the instances of the proxies created at runtime are parsed the same way.
Let's release the message once reported, and also on success in case a
parser fills it without failing.
This was brought by commit
b3075cf7f ("MEDIUM: filters: Parse and
finalize filter-config instances") in 3.5-dev9, so no backport is
needed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
proxy_type_str(proxy), proxy->id, inst->class->name,
inst->conf.file, inst->conf.line,
err && *err ? err : "unknown error");
+ free(err);
return ERR_ALERT | ERR_FATAL;
}
+ free(err);
if (!inst->fconf->ops) {
ha_alert("config: %s '%s' : filter class '%s' defined no callbacks for the instance from %s:%d.\n",
proxy_type_str(proxy), proxy->id, inst->class->name,