From 7d9e0ea7393c14cbf2d58364726951b14e0d4fc7 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Mon, 31 Jan 2011 18:09:19 +0100 Subject: glx: Properly check for a valid fd in dri2CreateScreen(). Signed-off-by: Brian Paul --- src/glx/dri2_glx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/glx/dri2_glx.c') 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); -- cgit v1.2.3