diff --git a/database_info.c b/database_info.c index b77b4b3e6e..ae2bd838dd 100644 --- a/database_info.c +++ b/database_info.c @@ -511,10 +511,11 @@ database_info_list_t *database_info_list_new( database_info_list->count = k; end: - database_cursor_close(db, cur); - if (db) + { + database_cursor_close(db, cur); libretrodb_free(db); + } if (cur) libretrodb_cursor_free(cur); diff --git a/gfx/drivers_context/drm_ctx.c b/gfx/drivers_context/drm_ctx.c index edd1c63a13..a632d01af4 100644 --- a/gfx/drivers_context/drm_ctx.c +++ b/gfx/drivers_context/drm_ctx.c @@ -325,8 +325,9 @@ static void free_drm_resources(gfx_ctx_drm_data_t *drm) drm_free(); - if (g_drm_fd >= 0) - filestream_close(drm->drm); + if (drm->drm) + if (g_drm_fd >= 0) + filestream_close(drm->drm); g_gbm_surface = NULL; g_gbm_dev = NULL; diff --git a/gfx/video_shader_driver.c b/gfx/video_shader_driver.c index 105365f559..705be1f825 100644 --- a/gfx/video_shader_driver.c +++ b/gfx/video_shader_driver.c @@ -79,7 +79,8 @@ bool video_shader_driver_get_prev_textures(video_shader_ctx_texture_t *texture) { if (!!texture || !current_shader) { - texture->id = 0; + if (texture) + texture->id = 0; return false; } texture->id = current_shader->get_prev_textures(shader_data);