Silence some Coverity errors

This commit is contained in:
twinaphex 2018-02-04 19:30:34 +01:00
parent 0b3545837e
commit 3d0e768e71
4 changed files with 11 additions and 12 deletions

View File

@ -1028,11 +1028,11 @@ static int cheevos_parse_expression(cheevos_expr_t *expr, const char* mem)
cheevos_term_t *terms = NULL;
char *end = NULL;
if (expr)
{
expr->count = 1;
expr->compare_count = 1;
}
if (!expr)
return -1;
expr->count = 1;
expr->compare_count = 1;
for (aux = mem;; aux++)
{

View File

@ -354,7 +354,8 @@ static bool rpng_save_image(const char *path,
GOTO_END_ERROR();
end:
filestream_close(file);
if (file)
filestream_close(file);
free(encode_buf);
free(deflate_buf);
free(rgba_line);

View File

@ -251,12 +251,9 @@ libretro_vfs_implementation_file *retro_vfs_file_open_impl(const char *path, uns
if ((stream->hints & RFILE_HINT_UNBUFFERED) == 0)
{
if (!mode_str)
goto error;
FILE *fp = fopen_utf8(path, mode_str);
stream->fp = fopen_utf8(path, mode_str);
if (!stream->fp)
if (!fp)
goto error;
/* Regarding setvbuf:
@ -269,6 +266,7 @@ libretro_vfs_implementation_file *retro_vfs_file_open_impl(const char *path, uns
* Since C89 does not support specifying a null buffer with a non-zero size, we create and track our own buffer for it.
*/
/* TODO: this is only useful for a few platforms, find which and add ifdef */
stream->fp = fp;
stream->buf = (char*)calloc(1, 0x4000);
setvbuf(stream->fp, stream->buf, _IOFBF, 0x4000);
}

View File

@ -1065,7 +1065,7 @@ static void xmb_update_thumbnail_path(void *data, unsigned i)
sizeof(new_path));
end:
if (!string_is_empty(new_path))
if (xmb && !string_is_empty(new_path))
xmb->thumbnail_file_path = strdup(new_path);
menu_entry_free(&entry);
}