Cleanup some allocations
This commit is contained in:
parent
a180b1094e
commit
0b3545837e
|
@ -3461,17 +3461,10 @@ static int action_ok_load_archive_detect_core(const char *path,
|
||||||
menu_handle_t *menu = NULL;
|
menu_handle_t *menu = NULL;
|
||||||
const char *menu_path = NULL;
|
const char *menu_path = NULL;
|
||||||
const char *content_path = NULL;
|
const char *content_path = NULL;
|
||||||
size_t path_size = PATH_MAX_LENGTH * sizeof(char);
|
char *new_core_path = NULL;
|
||||||
char *new_core_path = (char*)
|
|
||||||
malloc(PATH_MAX_LENGTH * sizeof(char));
|
|
||||||
|
|
||||||
new_core_path[0] = '\0';
|
|
||||||
|
|
||||||
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||||
{
|
|
||||||
free(new_core_path);
|
|
||||||
return menu_cbs_exit();
|
return menu_cbs_exit();
|
||||||
}
|
|
||||||
|
|
||||||
menu_path = menu->scratch2_buf;
|
menu_path = menu->scratch2_buf;
|
||||||
content_path = menu->scratch_buf;
|
content_path = menu->scratch_buf;
|
||||||
|
@ -3485,8 +3478,12 @@ static int action_ok_load_archive_detect_core(const char *path,
|
||||||
def_info.s = menu->deferred_path;
|
def_info.s = menu->deferred_path;
|
||||||
def_info.len = sizeof(menu->deferred_path);
|
def_info.len = sizeof(menu->deferred_path);
|
||||||
|
|
||||||
|
new_core_path = (char*)
|
||||||
|
malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||||
|
new_core_path[0] = '\0';
|
||||||
|
|
||||||
if (menu_content_find_first_core(&def_info, false,
|
if (menu_content_find_first_core(&def_info, false,
|
||||||
new_core_path, path_size))
|
new_core_path, PATH_MAX_LENGTH * sizeof(char)))
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
|
||||||
fill_pathname_join(detect_content_path, menu_path, content_path,
|
fill_pathname_join(detect_content_path, menu_path, content_path,
|
||||||
|
@ -3503,17 +3500,15 @@ static int action_ok_load_archive_detect_core(const char *path,
|
||||||
content_info.args = NULL;
|
content_info.args = NULL;
|
||||||
content_info.environ_get = NULL;
|
content_info.environ_get = NULL;
|
||||||
|
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
if (!task_push_load_content_with_new_core_from_menu(
|
if (!task_push_load_content_with_new_core_from_menu(
|
||||||
new_core_path, def_info.s,
|
new_core_path, def_info.s,
|
||||||
&content_info,
|
&content_info,
|
||||||
CORE_TYPE_PLAIN,
|
CORE_TYPE_PLAIN,
|
||||||
NULL, NULL))
|
NULL, NULL))
|
||||||
{
|
ret = -1;
|
||||||
free(new_core_path);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ret = 0;
|
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
idx = menu_navigation_get_selection();
|
idx = menu_navigation_get_selection();
|
||||||
|
@ -3577,9 +3572,8 @@ static int action_ok_netplay_enable_host(const char *path,
|
||||||
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
const char *label, unsigned type, size_t idx, size_t entry_idx)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_NETWORKING
|
#ifdef HAVE_NETWORKING
|
||||||
bool contentless = false;
|
bool contentless = false;
|
||||||
bool is_inited = false;
|
bool is_inited = false;
|
||||||
|
|
||||||
file_list_t *list = menu_entries_get_selection_buf_ptr(0);
|
file_list_t *list = menu_entries_get_selection_buf_ptr(0);
|
||||||
|
|
||||||
content_get_status(&contentless, &is_inited);
|
content_get_status(&contentless, &is_inited);
|
||||||
|
|
|
@ -1453,20 +1453,17 @@ static int create_string_list_rdb_entry_string(
|
||||||
file_list_t *list)
|
file_list_t *list)
|
||||||
{
|
{
|
||||||
union string_list_elem_attr attr;
|
union string_list_elem_attr attr;
|
||||||
size_t path_size = PATH_MAX_LENGTH * sizeof(char);
|
char *tmp = NULL;
|
||||||
char *tmp = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
|
||||||
char *output_label = NULL;
|
char *output_label = NULL;
|
||||||
int str_len = 0;
|
int str_len = 0;
|
||||||
struct string_list *str_list = string_list_new();
|
struct string_list *str_list = string_list_new();
|
||||||
|
|
||||||
if (!str_list)
|
if (!str_list)
|
||||||
{
|
|
||||||
free(tmp);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
|
|
||||||
attr.i = 0;
|
attr.i = 0;
|
||||||
tmp[0] = '\0';
|
tmp = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||||
|
tmp[0] = '\0';
|
||||||
|
|
||||||
str_len += strlen(label) + 1;
|
str_len += strlen(label) + 1;
|
||||||
string_list_append(str_list, label, attr);
|
string_list_append(str_list, label, attr);
|
||||||
|
@ -1490,7 +1487,7 @@ static int create_string_list_rdb_entry_string(
|
||||||
|
|
||||||
fill_pathname_join_concat_noext(tmp, desc, ": ",
|
fill_pathname_join_concat_noext(tmp, desc, ": ",
|
||||||
actual_string,
|
actual_string,
|
||||||
path_size);
|
PATH_MAX_LENGTH * sizeof(char));
|
||||||
menu_entries_append_enum(list, tmp, output_label,
|
menu_entries_append_enum(list, tmp, output_label,
|
||||||
enum_idx,
|
enum_idx,
|
||||||
0, 0, 0);
|
0, 0, 0);
|
||||||
|
@ -1511,8 +1508,8 @@ static int create_string_list_rdb_entry_int(
|
||||||
{
|
{
|
||||||
union string_list_elem_attr attr;
|
union string_list_elem_attr attr;
|
||||||
size_t path_size = PATH_MAX_LENGTH * sizeof(char);
|
size_t path_size = PATH_MAX_LENGTH * sizeof(char);
|
||||||
char *tmp = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
char *tmp = NULL;
|
||||||
char *str = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
char *str = NULL;
|
||||||
char *output_label = NULL;
|
char *output_label = NULL;
|
||||||
int str_len = 0;
|
int str_len = 0;
|
||||||
struct string_list *str_list = string_list_new();
|
struct string_list *str_list = string_list_new();
|
||||||
|
@ -1520,7 +1517,9 @@ static int create_string_list_rdb_entry_int(
|
||||||
if (!str_list)
|
if (!str_list)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
attr.i = 0;
|
attr.i = 0;
|
||||||
|
tmp = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||||
|
str = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||||
tmp[0] = str[0] = '\0';
|
tmp[0] = str[0] = '\0';
|
||||||
|
|
||||||
str_len += strlen(label) + 1;
|
str_len += strlen(label) + 1;
|
||||||
|
|
Loading…
Reference in New Issue