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 <leo.liu@amd.com>
diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri.c b/src/gallium/auxiliary/vl/vl_winsys_dri.c
index 0136526..9ecc216 100644
--- a/src/gallium/auxiliary/vl/vl_winsys_dri.c
+++ b/src/gallium/auxiliary/vl/vl_winsys_dri.c
@@ -427,13 +427,15 @@
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: