summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/glx/dri2_glx.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index ab7915c02ee..a275ba5b9fe 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -804,6 +804,8 @@ dri2CreateScreen(int screen, struct glx_display * priv)
return NULL;
memset(psc, 0, sizeof *psc);
+ psc->fd = -1;
+
if (!glx_screen_init(&psc->base, screen, priv)) {
Xfree(psc);
return NULL;
@@ -921,7 +923,7 @@ dri2CreateScreen(int screen, struct glx_display * priv)
return &psc->base;
handle_error:
- if (psc->fd)
+ if (psc->fd >= 0)
close(psc->fd);
if (psc->driver)
dlclose(psc->driver);