summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorEmil Velikov <[email protected]>2016-05-14 16:33:12 +0100
committerEmil Velikov <[email protected]>2016-05-23 12:07:47 +0100
commita155cdaace09e5fd2712528a6fa28ca3818d41a3 (patch)
tree8c5623e586d76da16e467eb9e8da61c492db82e1 /src/gallium/auxiliary
parented3f6ccce0f4fdc25705dd8c0beea8e9325db57f (diff)
vl/drm: don't call close(-1) in vl_drm_screen_create error path
Analogous to previous commits. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Leo Liu <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/vl/vl_winsys_drm.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/gallium/auxiliary/vl/vl_winsys_drm.c b/src/gallium/auxiliary/vl/vl_winsys_drm.c
index 6d9d947588c..6a759aeb3d3 100644
--- a/src/gallium/auxiliary/vl/vl_winsys_drm.c
+++ b/src/gallium/auxiliary/vl/vl_winsys_drm.c
@@ -41,20 +41,20 @@ struct vl_screen *
vl_drm_screen_create(int fd)
{
struct vl_screen *vscreen;
- int new_fd = -1;
+ int new_fd;
vscreen = CALLOC_STRUCT(vl_screen);
if (!vscreen)
return NULL;
if (fd < 0 || (new_fd = dup(fd)) < 0)
- goto error;
+ goto free_screen;
if (pipe_loader_drm_probe_fd(&vscreen->dev, new_fd))
vscreen->pscreen = pipe_loader_create_screen(vscreen->dev);
if (!vscreen->pscreen)
- goto error;
+ goto release_pipe;
vscreen->destroy = vl_drm_screen_destroy;
vscreen->texture_from_drawable = NULL;
@@ -64,12 +64,13 @@ vl_drm_screen_create(int fd)
vscreen->get_private = NULL;
return vscreen;
-error:
+release_pipe:
if (vscreen->dev)
pipe_loader_release(&vscreen->dev, 1);
else
close(new_fd);
+free_screen:
FREE(vscreen);
return NULL;
}