Try to fix plethora of resource leaks

This commit is contained in:
twinaphex 2016-09-20 16:32:33 +02:00
parent d81f40a9e1
commit 8095fa9ff8
1 changed files with 7 additions and 2 deletions

View File

@ -1651,6 +1651,7 @@ static bool config_load_file(const char *path, bool set_defaults,
settings_t *settings) settings_t *settings)
{ {
unsigned i; unsigned i;
bool ret = false;
bool tmp_bool = false; bool tmp_bool = false;
char *save = NULL; char *save = NULL;
char tmp_str[PATH_MAX_LENGTH] = {0}; char tmp_str[PATH_MAX_LENGTH] = {0};
@ -1676,13 +1677,16 @@ static bool config_load_file(const char *path, bool set_defaults,
{ {
conf = config_file_new(path); conf = config_file_new(path);
if (!conf) if (!conf)
return false; goto end;
} }
else else
conf = open_default_config_file(); conf = open_default_config_file();
if (!conf) if (!conf)
{
ret = true;
goto end; goto end;
}
if (set_defaults) if (set_defaults)
config_set_defaults(); config_set_defaults();
@ -2110,6 +2114,7 @@ static bool config_load_file(const char *path, bool set_defaults,
config_read_keybinds_conf(conf); config_read_keybinds_conf(conf);
ret = true;
end: end:
if (conf) if (conf)
@ -2124,7 +2129,7 @@ end:
free(array_settings); free(array_settings);
if (path_settings) if (path_settings)
free(path_settings); free(path_settings);
return true; return ret;
} }
/** /**