From 57e0e30600b1e07c714900caba72a10a11cc32af Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 28 Feb 2017 11:16:05 +0100 Subject: [PATCH] Update core_info.c --- core_info.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/core_info.c b/core_info.c index 3d56bb7009..67157db15b 100644 --- a/core_info.c +++ b/core_info.c @@ -840,7 +840,7 @@ bool core_info_database_supports_content_path(const char *database_path, const c new_path = path_basename(database_path); if (!string_is_empty(new_path)) - database = strdup(new_path); + database = strdup(new_path); if (!string_is_empty(database)) path_remove_extension(database); @@ -850,6 +850,9 @@ bool core_info_database_supports_content_path(const char *database_path, const c if (delim) archive_path = delim - 1; + if (string_is_empty(database)) + return false; + /* if the path contains a compressed file and the core supports archives, * we don't want to look at this file */ if (archive_path) @@ -865,8 +868,7 @@ bool core_info_database_supports_content_path(const char *database_path, const c && !string_list_find_elem(info->supported_extensions_list, "7z")) continue; - free(database); - return false; + goto error; } } @@ -877,16 +879,16 @@ bool core_info_database_supports_content_path(const char *database_path, const c if (!info || !string_list_find_elem(info->supported_extensions_list, path_get_extension(path))) continue; - if (!string_is_empty(database) || !string_list_find_elem(info->databases_list, database)) + if (!string_list_find_elem(info->databases_list, database)) continue; free(database); return true; } - if (!string_is_empty(database)) - free(database); +error: + free(database); return false; }