mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-02-23 21:21:19 +00:00
(database_info.c) Add some error handling
This commit is contained in:
parent
8bde46deb9
commit
99ea729d1c
@ -227,11 +227,20 @@ static int database_cursor_open(libretrodb_t *db,
|
||||
strlen(query), &error);
|
||||
|
||||
if (error)
|
||||
return -1;
|
||||
goto error;
|
||||
if ((libretrodb_cursor_open(db, cur, q)) != 0)
|
||||
return -1;
|
||||
goto error;
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
if (query)
|
||||
libretrodb_query_free(q);
|
||||
query = NULL;
|
||||
libretrodb_close(db);
|
||||
db = NULL;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int database_cursor_close(libretrodb_t *db, libretrodb_cursor_t *cur)
|
||||
|
@ -141,6 +141,9 @@ static void libretrodb_write_index_header(int fd, libretrodb_index_t * idx)
|
||||
|
||||
void libretrodb_close(libretrodb_t *db)
|
||||
{
|
||||
if (!db)
|
||||
return;
|
||||
|
||||
close(db->fd);
|
||||
db->fd = -1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user