Revert "(MSVC 2003) core_info - remove all_ext from heap - fixes crash with MSVC2003"

This reverts commit 50a57b03a18b52636debae5f4132791ad8a96db2.
This commit is contained in:
twinaphex 2019-05-10 08:31:18 +02:00
parent 89461bba08
commit b270ea6b79
2 changed files with 20 additions and 5 deletions

View File

@ -45,8 +45,24 @@ static void core_info_list_resolve_all_extensions(
core_info_list_t *core_info_list)
{
size_t i = 0;
size_t all_ext_len = 0;
char *all_ext = NULL;
core_info_list->all_ext[0] = '\0';
for (i = 0; i < core_info_list->count; i++)
{
if (core_info_list->list[i].supported_extensions)
all_ext_len +=
(strlen(core_info_list->list[i].supported_extensions) + 2);
}
all_ext_len += STRLEN_CONST("7z|") + STRLEN_CONST("zip|");
all_ext = (char*)calloc(1, all_ext_len);
if (!all_ext)
return;
core_info_list->all_ext = all_ext;
for (i = 0; i < core_info_list->count; i++)
{
@ -54,8 +70,7 @@ static void core_info_list_resolve_all_extensions(
continue;
strlcat(core_info_list->all_ext,
core_info_list->list[i].supported_extensions,
sizeof(core_info_list->all_ext));
core_info_list->list[i].supported_extensions, all_ext_len);
string_concat(core_info_list->all_ext, "|");
}
#ifdef HAVE_7ZIP
@ -165,6 +180,7 @@ static void core_info_list_free(core_info_list_t *core_info_list)
free(info->firmware);
}
free(core_info_list->all_ext);
free(core_info_list->list);
free(core_info_list);
}

View File

@ -22,7 +22,6 @@
#include <lists/string_list.h>
#include <retro_common_api.h>
#include <retro_miscellaneous.h>
RETRO_BEGIN_DECLS
@ -71,7 +70,7 @@ typedef struct
{
core_info_t *list;
size_t count;
char all_ext[PATH_MAX_LENGTH];
char *all_ext;
} core_info_list_t;
typedef struct core_info_ctx_firmware