summaryrefslogtreecommitdiffstats
path: root/src/glx/dri2_glx.c
diff options
context:
space:
mode:
authorHenri Verbeet <[email protected]>2011-01-29 15:00:48 -0800
committerBrian Paul <[email protected]>2011-01-31 09:29:54 -0700
commitbfc889517ad0d490cce1817eecac146d66bcd923 (patch)
tree584a723e55c950eedb8fa2d7f0195bd475ae7ffe /src/glx/dri2_glx.c
parentcbe9fc12a64c3ae89fd1b20e9e165aa4b76293a5 (diff)
glx: Fix leaks in DRI2 screen creation error paths.
Signed-off-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/glx/dri2_glx.c')
-rw-r--r--src/glx/dri2_glx.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index 75b1a103f01..ab7915c02ee 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -804,11 +804,14 @@ dri2CreateScreen(int screen, struct glx_display * priv)
return NULL;
memset(psc, 0, sizeof *psc);
- if (!glx_screen_init(&psc->base, screen, priv))
- return NULL;
+ if (!glx_screen_init(&psc->base, screen, priv)) {
+ Xfree(psc);
+ return NULL;
+ }
if (!DRI2Connect(priv->dpy, RootWindow(priv->dpy, screen),
&driverName, &deviceName)) {
+ glx_screen_cleanup(&psc->base);
XFree(psc);
return NULL;
}
@@ -918,12 +921,15 @@ dri2CreateScreen(int screen, struct glx_display * priv)
return &psc->base;
handle_error:
+ if (psc->fd)
+ close(psc->fd);
+ if (psc->driver)
+ dlclose(psc->driver);
Xfree(driverName);
Xfree(deviceName);
+ glx_screen_cleanup(&psc->base);
XFree(psc);
- /* FIXME: clean up here */
-
return NULL;
}