mirror of
https://github.com/rsyslog/rsyslog.git
synced 2026-04-23 11:28:12 +02:00
Why: ASan found a real leak in yaml-basic-yamlonly.sh. The translation tests had been masking the same issue by disabling leak detection, which is not acceptable for a real parser/loader bug. Impact: YAML script-buffer loading now shuts down cleanly under ASan, and the translation tests run without detect_leaks=0 overrides. Before/After: Before, YAML ruleset script loading leaked the top-level synthetic lexer buffer name and tests suppressed leak detection. After, the leak is freed in the lexer teardown path and the related tests run cleanly with ASan leak detection enabled. Technical Overview: The YAML loader can push synthetic RainerScript buffers into the lexer stack via cnfAddConfigBuffer(). For top-level synthetic buffers, yamlconf restores cnfcurrfn before the lexer pop path runs, so the old top-level-name exception in popfile() left the duplicated buffer name unreachable. Adjust popfile() to free the top-level buffer name when cnfcurrfn no longer points at that allocation, while preserving the normal top-level file path ownership model. Remove the temporary detect_leaks=0 overrides from the config-translate shell tests now that the underlying leak is fixed. Validate with yaml-basic-yamlonly.sh and the translation test set under ASan. With the help of AI-Agents: Codex