diff --git a/frontend/drivers/platform_linux.c b/frontend/drivers/platform_linux.c index 52207633bd..7a951e4c7e 100644 --- a/frontend/drivers/platform_linux.c +++ b/frontend/drivers/platform_linux.c @@ -245,7 +245,6 @@ typedef struct */ static void cpulist_parse(CpuList* list, const char* line, int line_len) { - const char* q; const char* p = line; const char* end = p + line_len; @@ -255,10 +254,10 @@ static void cpulist_parse(CpuList* list, const char* line, int line_len) while (p < end && *p != '\n') { int val, start_value, end_value; - /* Find the end of current item, and put it into 'q' */ - q = memchr(p, ',', end-p); - if (q == NULL) + const char *q = (const char*)memchr(p, ',', end-p); + + if (!q) q = end; /* Get first value */ diff --git a/libretro-db/libretrodb.c b/libretro-db/libretrodb.c index 7c27fbf5e7..f416e6c6fb 100644 --- a/libretro-db/libretrodb.c +++ b/libretro-db/libretrodb.c @@ -224,6 +224,7 @@ int libretrodb_open(const char *path, libretrodb_t *db) db->first_index_offset = lseek(fd, 0, SEEK_CUR); db->fd = fd; return 0; + error: close(fd); return rv;