Prevent some Coverity warnings

This commit is contained in:
twinaphex 2016-09-29 19:24:18 +02:00
parent b83d2529e2
commit d6b9c4f17a
2 changed files with 14 additions and 9 deletions

View File

@ -711,13 +711,17 @@ static bool init_content_file_set_attribs(
**/
static bool content_file_init(struct string_list *temporary_content)
{
unsigned i;
struct retro_game_info *info = NULL;
struct string_list *content = NULL;
bool ret = false;
const struct retro_subsystem_info *special = init_content_file_subsystem(&ret);
struct string_list *content = string_list_new();
if (!ret || !content)
if (!ret)
goto error;
content = string_list_new();
if (!content)
goto error;
if (!init_content_file_set_attribs(temporary_content,
@ -728,13 +732,15 @@ static bool content_file_init(struct string_list *temporary_content)
calloc(content->size, sizeof(*info));
if (info)
{
unsigned i;
ret = load_content(temporary_content, info, content, special);
for (i = 0; i < content->size; i++)
free((void*)info[i].data);
for (i = 0; i < content->size; i++)
free((void*)info[i].data);
if (info)
free(info);
}
error:
if (content)

View File

@ -147,7 +147,7 @@ static void task_decompress_handler(retro_task_t *task)
int ret;
bool retdec = false;
struct archive_extract_userdata userdata = {{0}};
decompress_state_t *dec = task ? (decompress_state_t*)task->state : NULL;
decompress_state_t *dec = (decompress_state_t*)task->state;
userdata.dec = dec;
strlcpy(userdata.archive_path, dec->source_file, sizeof(userdata.archive_path));
@ -172,8 +172,7 @@ static void task_decompress_handler_target_file(retro_task_t *task)
bool retdec;
int ret;
struct archive_extract_userdata userdata = {{0}};
decompress_state_t *dec = task ?
(decompress_state_t*)task->state : NULL;
decompress_state_t *dec = (decompress_state_t*)task->state;
strlcpy(userdata.archive_path,
dec->source_file, sizeof(userdata.archive_path));