Fix double frees and resource leaks

This commit is contained in:
twinaphex 2016-06-01 02:40:58 +02:00
parent 2e42778f1e
commit ffdad57318
4 changed files with 7 additions and 4 deletions

View File

@ -714,11 +714,11 @@ bool core_info_get_display_name(const char *path, char *s, size_t len)
config_get_string(conf, "display_name",
&display_name);
config_file_free(conf);
if (!core_name || !display_name)
goto error;
config_file_free(conf);
snprintf(s, len,"%s",display_name);
free(core_name);

View File

@ -557,7 +557,6 @@ int libretrodb_create_index(libretrodb_t *db,
nictx.db = db;
nictx.idx = &idx;
bintree_iterate(tree, node_iter, &nictx);
bintree_free(tree);
clean:
rmsgpack_dom_value_free(&item);

View File

@ -180,7 +180,10 @@ static int detect_ps1_game_sub(const char *track_path,
while (tmp < (buffer + 2048 * 2))
{
if (!*tmp)
{
filestream_close(fp);
return 0;
}
if (!strncasecmp((const char*)(tmp + 33), "SYSTEM.CNF;1", 12))
break;

View File

@ -195,11 +195,12 @@ bool content_load_state(const char *path)
for (i = 0; i < num_blocks; i++)
free(blocks[i].data);
free(blocks);
free(buf);
if (!ret)
goto error;
free(buf);
return true;
error: