From b4143c272419b52cea6314123602a07faa7a6dbc Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Wed, 4 Mar 2015 08:22:14 +0100 Subject: [PATCH] Fix memory leak when evaluating init.conf refs #8593 --- icinga-app/icinga.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/icinga-app/icinga.cpp b/icinga-app/icinga.cpp index cb7309a52..3a7ba1442 100644 --- a/icinga-app/icinga.cpp +++ b/icinga-app/icinga.cpp @@ -213,9 +213,20 @@ int Main(void) String initconfig = Application::GetSysconfDir() + "/icinga2/init.conf"; if (Utility::PathExists(initconfig)) { - ScriptFrame frame; - Expression *expression = ConfigCompiler::CompileFile(initconfig); - expression->Evaluate(frame); + Expression *expression; + try { + expression = ConfigCompiler::CompileFile(initconfig); + + ScriptFrame frame; + expression->Evaluate(frame); + } catch (const std::exception& ex) { + delete expression; + + Log(LogCritical, "config", DiagnosticInformation(ex)); + return EXIT_FAILURE; + } + + delete expression; } #ifndef _WIN32 -- 2.40.0