From bd9ae724591d23d029ee9f8a2f200b60bf6fba2c Mon Sep 17 00:00:00 2001 From: Leo Liu Date: Thu, 12 May 2016 10:05:57 -0400 Subject: [PATCH] vl/dri: fix close fd error out fd should be set to -1 only if it got closed by pipe_loader_release. Signed-off-by: Leo Liu --- src/gallium/auxiliary/vl/vl_winsys_dri.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri.c b/src/gallium/auxiliary/vl/vl_winsys_dri.c index 01365260312..9ecc216b9c5 100644 --- a/src/gallium/auxiliary/vl/vl_winsys_dri.c +++ b/src/gallium/auxiliary/vl/vl_winsys_dri.c @@ -427,13 +427,15 @@ vl_dri2_screen_create(Display *display, int screen) return &scrn->base; release_pipe: - if (scrn->base.dev) + if (scrn->base.dev) { pipe_loader_release(&scrn->base.dev, 1); - fd = -1; + fd = -1; + } free_authenticate: free(authenticate); close_fd: - close(fd); + if (fd != -1) + close(fd); free_connect: free(connect); free_query: -- 2.30.2