(DRM) Prevent double free and prevent dereference before NULL check

This commit is contained in:
twinaphex 2016-05-23 22:30:01 +02:00
parent d5d2f7f8ee
commit c17315cd27
3 changed files with 8 additions and 5 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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);