vl/dri: fix close fd error out
authorLeo Liu <leo.liu@amd.com>
Thu, 12 May 2016 14:05:57 +0000 (10:05 -0400)
committerLeo Liu <leo.liu@amd.com>
Thu, 12 May 2016 22:26:48 +0000 (18:26 -0400)
fd should be set to -1 only if it got closed by pipe_loader_release.

Signed-off-by: Leo Liu <leo.liu@amd.com>
src/gallium/auxiliary/vl/vl_winsys_dri.c

index 01365260312e492cdf3590e12cb2d99ce3277808..9ecc216b9c533a2fe9f834510b4e9927798218b9 100644 (file)
@@ -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: