Fix memory leak when evaluating init.conf

refs #8593
This commit is contained in:
Gunnar Beutner 2015-03-04 08:22:14 +01:00
parent 9bbe9a4875
commit b4143c2724

View File

@ -213,9 +213,20 @@ int Main(void)
String initconfig = Application::GetSysconfDir() + "/icinga2/init.conf"; String initconfig = Application::GetSysconfDir() + "/icinga2/init.conf";
if (Utility::PathExists(initconfig)) { if (Utility::PathExists(initconfig)) {
ScriptFrame frame; Expression *expression;
Expression *expression = ConfigCompiler::CompileFile(initconfig); try {
expression->Evaluate(frame); 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 #ifndef _WIN32