From a3bf8b472b2a6b418faac8a0c979bc054c3fe7ff Mon Sep 17 00:00:00 2001 From: Mark Stemm Date: Mon, 24 Jun 2024 17:52:41 -0700 Subject: [PATCH] If rule compilation fails, return immediately There's no need to populate rulesets with the output if compilation failed. Signed-off-by: Mark Stemm --- userspace/engine/falco_engine.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/userspace/engine/falco_engine.cpp b/userspace/engine/falco_engine.cpp index 69da2bd13e9..0d22dffe950 100644 --- a/userspace/engine/falco_engine.cpp +++ b/userspace/engine/falco_engine.cpp @@ -204,6 +204,11 @@ std::unique_ptr falco_engine::load_rules(const std::string &rules_c m_last_compile_output = m_rule_compiler->new_compile_output(); m_rule_compiler->compile(cfg, *m_rule_collector, *m_last_compile_output); + if(!cfg.res->successful()) + { + return std::move(cfg.res); + } + // clear the rules known by the engine and each ruleset m_rules.clear(); for (auto &src : m_sources)