Fix some high-priority Coverity-catched defects

This commit is contained in:
twinaphex 2016-09-20 16:10:27 +02:00
parent b3f50a3758
commit 1a55721c78
2 changed files with 15 additions and 6 deletions

View File

@ -1682,7 +1682,7 @@ static bool config_load_file(const char *path, bool set_defaults,
conf = open_default_config_file();
if (!conf)
return true;
goto end;
if (set_defaults)
config_set_defaults();
@ -2111,7 +2111,9 @@ static bool config_load_file(const char *path, bool set_defaults,
config_read_keybinds_conf(conf);
config_file_free(conf);
end:
if (conf)
config_file_free(conf);
if (bool_settings)
free(bool_settings);
if (int_settings)
@ -3193,6 +3195,8 @@ bool config_save_overrides(int override_type)
if (path_overrides)
free(path_overrides);
free(settings);
if (conf)
config_file_free(conf);
return ret;
}

View File

@ -287,16 +287,16 @@ static int sevenzip_parse_file_init(file_archive_transfer_t *state,
(struct sevenzip_context_t*)sevenzip_stream_new();
if (state->archive_size < SEVENZIP_MAGIC_LEN)
return -1;
goto error;
if (memcmp(state->data, SEVENZIP_MAGIC, SEVENZIP_MAGIC_LEN) != 0)
return -1;
goto error;
state->stream = sevenzip_context;
/* could not open 7zip archive? */
if (InFile_Open(&sevenzip_context->archiveStream.file, file))
return -1;
goto error;
FileInStream_CreateVTable(&sevenzip_context->archiveStream);
LookToRead_CreateVTable(&sevenzip_context->lookStream, False);
@ -307,9 +307,14 @@ static int sevenzip_parse_file_init(file_archive_transfer_t *state,
if (SzArEx_Open(&sevenzip_context->db, &sevenzip_context->lookStream.s,
&sevenzip_context->allocImp, &sevenzip_context->allocTempImp) != SZ_OK)
return -1;
goto error;
return 0;
error:
if (sevenzip_context)
sevenzip_stream_free(sevenzip_context);
return -1;
}
static int sevenzip_parse_file_iterate_step_internal(