This commit is contained in:
twinaphex 2017-05-14 05:06:01 +02:00
parent 2df6b201da
commit f70da4c2e2

View File

@ -495,19 +495,16 @@ static bool content_file_load(
const struct string_list *content, const struct string_list *content,
content_information_ctx_t *content_ctx, content_information_ctx_t *content_ctx,
char **error_string, char **error_string,
const struct retro_subsystem_info *special const struct retro_subsystem_info *special,
struct string_list *additional_path_allocs
) )
{ {
unsigned i; unsigned i;
retro_ctx_load_content_info_t load_info; retro_ctx_load_content_info_t load_info;
char msg[1024]; char msg[1024];
struct string_list *additional_path_allocs = string_list_new();
msg[0] = '\0'; msg[0] = '\0';
if (!additional_path_allocs)
return false;
for (i = 0; i < content->size; i++) for (i = 0; i < content->size; i++)
{ {
int attr = content->elems[i].attr.i; int attr = content->elems[i].attr.i;
@ -522,7 +519,7 @@ static bool content_file_load(
sizeof(msg) sizeof(msg)
); );
*error_string = strdup(msg); *error_string = strdup(msg);
goto error; return false;
} }
info[i].path = NULL; info[i].path = NULL;
@ -545,7 +542,7 @@ static bool content_file_load(
msg_hash_to_str(MSG_COULD_NOT_READ_CONTENT_FILE), msg_hash_to_str(MSG_COULD_NOT_READ_CONTENT_FILE),
path); path);
*error_string = strdup(msg); *error_string = strdup(msg);
goto error; return false;
} }
info[i].size = len; info[i].size = len;
@ -565,7 +562,7 @@ static bool content_file_load(
&info[i], i, &info[i], i,
additional_path_allocs, need_fullpath, path, additional_path_allocs, need_fullpath, path,
error_string)) error_string))
goto error; return false;
#endif #endif
} }
} }
@ -579,7 +576,7 @@ static bool content_file_load(
snprintf(msg, sizeof(msg), snprintf(msg, sizeof(msg),
"%s.", msg_hash_to_str(MSG_FAILED_TO_LOAD_CONTENT)); "%s.", msg_hash_to_str(MSG_FAILED_TO_LOAD_CONTENT));
*error_string = strdup(msg); *error_string = strdup(msg);
goto error; return false;
} }
#ifdef HAVE_CHEEVOS #ifdef HAVE_CHEEVOS
@ -592,14 +589,7 @@ static bool content_file_load(
} }
#endif #endif
string_list_free(additional_path_allocs);
return true; return true;
error:
string_list_free(additional_path_allocs);
return false;
} }
static const struct retro_subsystem_info *content_file_init_subsystem( static const struct retro_subsystem_info *content_file_init_subsystem(
@ -754,8 +744,10 @@ static bool content_file_init(
if (info) if (info)
{ {
unsigned i; unsigned i;
struct string_list *additional_path_allocs = string_list_new();
ret = content_file_load(info, content, content_ctx, error_string, ret = content_file_load(info, content, content_ctx, error_string,
special); special, additional_path_allocs);
string_list_free(additional_path_allocs);
for (i = 0; i < content->size; i++) for (i = 0; i < content->size; i++)
free((void*)info[i].data); free((void*)info[i].data);