Check return value of XOpenDisplay().
Instead of calling XGetXCBConnection() blindly, check XOpenDisplay()'s return value to avoid a possible segfault in the former. That happens if $DISPLAY is set, but if that display isn't available. Signed-off-by: Cyril Brulebois <kibi@debian.org>
This commit is contained in:
committed by
Kristian Høgsberg
parent
8d85e886fc
commit
20798291ca
@@ -553,6 +553,10 @@ x11_compositor_create(struct wl_display *display, int width, int height)
|
|||||||
memset(c, 0, sizeof *c);
|
memset(c, 0, sizeof *c);
|
||||||
|
|
||||||
c->dpy = XOpenDisplay(NULL);
|
c->dpy = XOpenDisplay(NULL);
|
||||||
|
|
||||||
|
if (c->dpy == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
c->conn = XGetXCBConnection(c->dpy);
|
c->conn = XGetXCBConnection(c->dpy);
|
||||||
|
|
||||||
if (xcb_connection_has_error(c->conn))
|
if (xcb_connection_has_error(c->conn))
|
||||||
|
|||||||
Reference in New Issue
Block a user