1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-16 01:57:09 +00:00

Fix leaks that happen when there is no config available (these are only tiny leaks because conky will shutdown anyway when there is no config available)

This commit is contained in:
Nikolas Garofil 2010-11-20 23:35:02 +01:00
parent 0ee557a4ee
commit cad18ce2e0

View File

@ -4173,7 +4173,7 @@ void set_current_config() {
NORM_ERR(NOCFGFILEFOUND NORM_ERR(NOCFGFILEFOUND
", using builtin default"); ", using builtin default");
#else #else
CRIT_ERR(NULL, NULL, NOCFGFILEFOUND); throw std::runtime_error(NOCFGFILEFOUND);
#endif /* ! CONF_OUTPUT */ #endif /* ! CONF_OUTPUT */
} }
} }
@ -4201,7 +4201,8 @@ void initialisation(int argc, char **argv) {
} }
} }
if(for_scripts == false) { if(for_scripts == false) {
set_current_config(); try { set_current_config(); }
catch(std::runtime_error &e) { throw e; }
load_config_file(current_config.c_str()); load_config_file(current_config.c_str());
currentconffile = conftree_add(currentconffile, current_config.c_str()); currentconffile = conftree_add(currentconffile, current_config.c_str());
} }
@ -4469,7 +4470,11 @@ int main(int argc, char **argv)
} }
} }
set_current_config(); try { set_current_config(); }
catch(std::runtime_error &e) {
std::cerr << e.what() << std::endl;
return EXIT_FAILURE;
}
#ifdef BUILD_WEATHER_XOAP #ifdef BUILD_WEATHER_XOAP
/* Load xoap keys, if existing */ /* Load xoap keys, if existing */
@ -4500,6 +4505,10 @@ int main(int argc, char **argv)
clean_up(NULL, NULL); clean_up(NULL, NULL);
return EXIT_FAILURE; return EXIT_FAILURE;
} }
catch(std::runtime_error &e) {
std::cerr << e.what() << std::endl;
return EXIT_FAILURE;
}
#ifdef BUILD_CURL #ifdef BUILD_CURL
curl_global_cleanup(); curl_global_cleanup();