Skip to content
Snippets Groups Projects
Commit 1546b6ce authored by Emmanuel Lepage's avatar Emmanuel Lepage
Browse files

Fix a segfault when config is not present

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