diff options
author | Emil Velikov <[email protected]> | 2015-07-29 17:19:02 +0100 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2015-08-07 19:13:35 +0100 |
commit | 60e9c35b3a0384860ffcb01d902a69ee13254eb9 (patch) | |
tree | 4d307d017e131f2d4f80050dd66d728594b090c1 /src/egl/drivers/dri2/platform_x11.c | |
parent | 75ce7919d6496981013a21a7055c668e47e7bed2 (diff) |
egl/x11: bail out if we cannot fetch the xcb connection
The documentation of xcb_connection_has_error() does not mention
what will happen, if NULL is fed to the function.
Upon closer look (props to Matt), it seems that we'll crash as the
implementation dereferences conn.
This will also allow us to remove the dri2_dpy->conn checking with the
next commit.
v2: Reword commit message as per Matt's findings.
Acked-by: Alex Deucher <[email protected]>
Signed-off-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/egl/drivers/dri2/platform_x11.c')
-rw-r--r-- | src/egl/drivers/dri2/platform_x11.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c index fecd36b3e7e..7a28318c008 100644 --- a/src/egl/drivers/dri2/platform_x11.c +++ b/src/egl/drivers/dri2/platform_x11.c @@ -1222,7 +1222,7 @@ dri2_initialize_x11_dri2(_EGLDriver *drv, _EGLDisplay *disp) dri2_dpy->screen = DefaultScreen(dpy); } - if (xcb_connection_has_error(dri2_dpy->conn)) { + if (!dri2_dpy->conn || xcb_connection_has_error(dri2_dpy->conn)) { _eglLog(_EGL_WARNING, "DRI2: xcb_connect failed"); goto cleanup_dpy; } |