Backport Lioncash' memory leak fixes

This commit is contained in:
twinaphex 2015-01-27 15:35:31 +01:00
parent abe3bf4626
commit ae573dcdb8
5 changed files with 13 additions and 3 deletions

View File

@ -73,7 +73,10 @@ bool cheat_manager_save(cheat_manager_t *handle, const char *path)
return false;
if (!handle)
{
config_file_free(conf);
return false;
}
config_set_int(conf, "cheats", handle->size);

View File

@ -674,7 +674,10 @@ static bool load_preset(cg_shader_data_t *cg, const char *path)
cg->cg_shader = (struct video_shader*)calloc(1, sizeof(*cg->cg_shader));
if (!cg->cg_shader)
{
config_file_free(conf);
return false;
}
if (!video_shader_read_conf_cgp(conf, cg->cg_shader))
{

View File

@ -314,7 +314,10 @@ static bool load_preset(hlsl_shader_data_t *hlsl, void *data, const char *path)
if (!hlsl->cg_shader)
hlsl->cg_shader = (struct video_shader*)calloc(1, sizeof(*hlsl->cg_shader));
if (!hlsl->cg_shader)
{
config_file_free(conf);
return false;
}
if (!video_shader_read_conf_cgp(conf, hlsl->cg_shader))
{

View File

@ -78,7 +78,7 @@ static bool rpng_image_load_tga_shift(const char *path,
tmp = buf + 18;
bits_mul = 3;
if (bits != 32 || bits != 24)
if (bits != 32 && bits != 24)
{
RARCH_ERR("Bit depth of TGA image is wrong. Only 32-bit and 24-bit supported.\n");
free(buf);

View File

@ -384,10 +384,11 @@ static void xui_render_message(const char *msg)
struct string_list *list = string_split(msg, "\n");
d3d_video_t *d3d = (d3d_video_t*)driver.video_data;
if (!list || !d3d)
if (!list)
return;
if (list->elems == 0)
if (!d3d || list->elems == 0)
{
string_list_free(list);
return;