Resource leaks fixes (catched by Coverity)

This commit is contained in:
twinaphex 2016-05-26 17:26:55 +02:00
parent 9624406438
commit 0f954fd4c8
6 changed files with 13 additions and 0 deletions

View File

@ -2010,6 +2010,7 @@ static unsigned cheevos_find_game_id_nes(
MD5_Update(&ctx, (void*) data, rom_size << 14);
MD5_Final(hash, &ctx);
free(data);
}
to = timeout;

View File

@ -82,6 +82,7 @@ int config_userdata_get_float_array(void *userdata, const char *key_str,
(*values)[i] = (float)strtod(list->elems[i].data, NULL);
*out_num_values = list->size;
string_list_free(list);
free(str);
return true;
}
@ -111,6 +112,7 @@ int config_userdata_get_int_array(void *userdata, const char *key_str,
(*values)[i] = (int)strtod(list->elems[i].data, NULL);
*out_num_values = list->size;
string_list_free(list);
free(str);
return true;
}

View File

@ -783,7 +783,10 @@ static struct rpng_process *rpng_process_init(rpng_t *rpng, unsigned *width, uns
process->stream = process->stream_backend->stream_new();
if (!process->stream)
{
free(process);
return NULL;
}
if (!process->stream_backend->stream_decompress_init(process->stream))
{

View File

@ -566,6 +566,7 @@ clean:
if (cur.is_valid)
libretrodb_cursor_close(&cur);
bintree_free(tree);
free(tree);
return 0;
}

View File

@ -520,7 +520,10 @@ static bool apply_patch_content(uint8_t **buf,
if (!filestream_read_file(patch_path, &patch_data, &patch_size))
return false;
if (patch_size < 0)
{
free(patch_data);
return false;
}
if (!path_file_exists(patch_path))
{

View File

@ -191,7 +191,10 @@ static int detect_ps1_game_sub(const char *track_path,
tmp += *tmp;
}
if(tmp >= (buffer + 2048 * 2))
{
filestream_close(fp);
return 0;
}
cd_sector = tmp[2] | (tmp[3] << 8) | (tmp[4] << 16);
filestream_seek(fp, 13 + skip + cd_sector * frame_size, SEEK_SET);