diff --git a/menu/menu_driver.c b/menu/menu_driver.c index dc788d95f2..95d896efd9 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -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)