(Coverity) Fix some resource leaks

This commit is contained in:
twinaphex 2016-05-23 21:28:43 +02:00
parent 0a3224180b
commit faef7b498d
6 changed files with 15 additions and 2 deletions

View File

@ -220,8 +220,12 @@ static bool input_autoconfigure_joypad_from_conf_dir(
list = dir_list_new_special(path, DIR_LIST_AUTOCONFIG, "cfg");
if (!list || !list->size)
{
if (list)
string_list_free(list);
list = dir_list_new_special(settings->directory.autoconfig,
DIR_LIST_AUTOCONFIG, "cfg");
}
if(!list)
return false;

View File

@ -791,7 +791,7 @@ static struct rpng_process *rpng_process_init(rpng_t *rpng,
inflate_buf = (uint8_t*)malloc(process->inflate_buf_size);
if (!inflate_buf)
return NULL;
goto error;
process->inflate_buf = inflate_buf;
process->stream_backend->stream_set(
@ -802,6 +802,11 @@ static struct rpng_process *rpng_process_init(rpng_t *rpng,
process->inflate_buf);
return process;
error:
if (process)
free(process);
return NULL;
}
static bool read_chunk_header(uint8_t *buf, struct png_chunk *chunk)

View File

@ -995,6 +995,7 @@ void *libretrodb_query_compile(libretrodb_t *db,
if (!q->root.func)
{
raise_unexpected_eof(buff.offset, error);
libretrodb_query_free(q);
return NULL;
}
goto success;

View File

@ -126,7 +126,7 @@ struct string_list *string_list_new_special(enum string_list_type type,
struct string_list *s = string_list_new();
if (!s || !len)
return NULL;
goto error;
attr.i = 0;
*len = 0;

View File

@ -1949,6 +1949,8 @@ static int menu_displaylist_parse_database_entry(menu_displaylist_info_t *info)
return 0;
error:
if (db_info)
database_info_list_free(db_info);
playlist_free(playlist);
return -1;

View File

@ -394,6 +394,7 @@ error:
rarch_task_image_load_free(t);
if (t)
free(t);
nbio_free(handle);
if (nbio)
free(nbio);