shaders: fix memory leak

This commit is contained in:
Brad Parker 2018-08-14 18:44:19 -04:00
parent 6de4384350
commit 4a86d29810
1 changed files with 18 additions and 8 deletions

View File

@ -155,6 +155,7 @@ static bool video_shader_parse_pass(config_file_t *conf,
strlcpy(pass->source.path, tmp_str, sizeof(pass->source.path));
else
strlcpy(pass->source.path, tmp_path, sizeof(pass->source.path));
free(tmp_path);
/* Smooth */
@ -208,7 +209,10 @@ static bool video_shader_parse_pass(config_file_t *conf,
config_get_array(conf, scale_name_buf, scale_type_y, sizeof(scale_type_y));
if (!*scale_type && !*scale_type_x && !*scale_type_y)
{
free(tmp_str);
return true;
}
if (*scale_type)
{
@ -253,6 +257,7 @@ static bool video_shader_parse_pass(config_file_t *conf,
}
snprintf(attr_name_buf, sizeof(attr_name_buf), "scale%u", i);
if (scale->type_x == RARCH_SCALE_ABSOLUTE)
{
if (config_get_int(conf, attr_name_buf, &iattr))
@ -277,6 +282,7 @@ static bool video_shader_parse_pass(config_file_t *conf,
}
snprintf(attr_name_buf, sizeof(attr_name_buf), "scale%u", i);
if (scale->type_y == RARCH_SCALE_ABSOLUTE)
{
if (config_get_int(conf, attr_name_buf, &iattr))
@ -752,11 +758,14 @@ bool video_shader_read_conf_cgp(config_file_t *conf,
if (!video_shader_parse_pass(conf, &shader->pass[i], i))
{
if (file_list)
{
string_list_free(file_list);
file_list = NULL;
}
return false;
}
if (settings->bools.video_shader_watch_files)
if (settings->bools.video_shader_watch_files && file_list)
string_list_append(file_list,
shader->pass[i].source.path, attr);
}
@ -770,6 +779,7 @@ bool video_shader_read_conf_cgp(config_file_t *conf,
frontend_driver_watch_path_for_changes(file_list,
flags, &file_change_data);
if (file_list)
string_list_free(file_list);
}