Reduce stack usage of menu_display_reset_textures_list

This commit is contained in:
twinaphex 2017-09-09 05:41:23 +02:00
parent 12957e461d
commit 8792e78102

View File

@ -1294,9 +1294,10 @@ void menu_display_reset_textures_list(
uintptr_t *item, enum texture_filter_type filter_type)
{
struct texture_image ti;
char path[PATH_MAX_LENGTH];
char *texpath = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
size_t texpath_size = PATH_MAX_LENGTH * sizeof(char);
path[0] = '\0';
texpath[0] = '\0';
ti.width = 0;
ti.height = 0;
@ -1304,17 +1305,23 @@ void menu_display_reset_textures_list(
ti.supports_rgba = video_driver_supports_rgba();
if (!string_is_empty(texture_path))
fill_pathname_join(path, iconpath, texture_path, sizeof(path));
fill_pathname_join(texpath, iconpath, texture_path, texpath_size);
if (string_is_empty(path) || !path_file_exists(path))
return;
if (string_is_empty(texpath) || !path_file_exists(texpath))
goto error;
if (!image_texture_load(&ti, path))
return;
if (!image_texture_load(&ti, texpath))
goto error;
video_driver_texture_load(&ti,
filter_type, item);
image_texture_free(&ti);
free(texpath);
return;
error:
free(texpath);
}
bool menu_driver_is_binding_state(void)