Commit 1546b6ce authored by Emmanuel Lepage's avatar Emmanuel Lepage

Fix a segfault when config is not present

parent 3eb4d41a
......@@ -63,9 +63,10 @@ YamlParser::YamlParser (const char *file) : filename (file)
YamlParser::~YamlParser()
{
fclose (fd);
yaml_parser_delete (&parser);
if (fd) {
fclose (fd);
yaml_parser_delete (&parser);
}
for (int i = 0; i < eventNumber; i++)
yaml_event_delete (&events[i]);
......
......@@ -98,7 +98,7 @@ void ManagerImpl::init (std::string config_file)
_debug ("Manager: configuration file path: %s", _path.c_str());
Conf::YamlParser *parser;
Conf::YamlParser *parser = NULL;
try {
parser = new Conf::YamlParser (_path.c_str());
......@@ -107,6 +107,7 @@ void ManagerImpl::init (std::string config_file)
parser->constructNativeData();
} catch (Conf::YamlParserException &e) {
_error ("Manager: %s", e.what());
fflush(stderr);
delete parser;
parser = NULL;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment