From cc1124430728f07d6b148cccba3a9a734549261c Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 22 Sep 2016 00:58:19 +0200 Subject: [PATCH] Fix memory leak --- configuration.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/configuration.c b/configuration.c index fa827ae4e7..6515f5bb9c 100644 --- a/configuration.c +++ b/configuration.c @@ -3162,22 +3162,25 @@ bool config_save_overrides(int override_type) } } - if (override_type == OVERRIDE_CORE) + ret = false; + + switch (override_type) { - RARCH_LOG ("[overrides] path %s\n", core_path); - /* Create a new config file from core_path */ - ret = config_file_write(conf, core_path); - config_file_free(conf); + case OVERRIDE_CORE: + /* Create a new config file from core_path */ + RARCH_LOG ("[overrides] path %s\n", core_path); + ret = config_file_write(conf, core_path); + break; + case OVERRIDE_GAME: + /* Create a new config file from core_path */ + RARCH_LOG ("[overrides] path %s\n", game_path); + ret = config_file_write(conf, game_path); + break; + default: + break; } - else if(override_type == OVERRIDE_GAME) - { - RARCH_LOG ("[overrides] path %s\n", game_path); - /* Create a new config file from core_path */ - ret = config_file_write(conf, game_path); - config_file_free(conf); - } - else - ret = false; + + config_file_free(conf); if (bool_settings) free(bool_settings);