summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenri Verbeet <[email protected]>2011-01-31 18:09:19 +0100
committerBrian Paul <[email protected]>2011-01-31 10:54:04 -0700
commit7d9e0ea7393c14cbf2d58364726951b14e0d4fc7 (patch)
treeea9dc2b70195295e69f35f402962437fa502131a
parent5a1ce49c82e245f1f86510d9e1ff7db46a32012b (diff)
glx: Properly check for a valid fd in dri2CreateScreen().
Signed-off-by: Brian Paul <[email protected]>
-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);