[PATCH:wayland-demos 2/2] Check return value of XOpenDisplay().
Kristian Høgsberg
krh at bitplanet.net
Thu Apr 7 06:09:10 PDT 2011
On Wed, Apr 6, 2011 at 12:05 PM, Cyril Brulebois <kibi at debian.org> wrote:
> 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.
Ah, yes, thanks. Applied.
Kristian
> Signed-off-by: Cyril Brulebois <kibi at debian.org>
> ---
> compositor/compositor-x11.c | 4 ++++
> 1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/compositor/compositor-x11.c b/compositor/compositor-x11.c
> index ba593c1..acc08fa 100644
> --- a/compositor/compositor-x11.c
> +++ b/compositor/compositor-x11.c
> @@ -553,6 +553,10 @@ x11_compositor_create(struct wl_display *display, int width, int height)
> memset(c, 0, sizeof *c);
>
> c->dpy = XOpenDisplay(NULL);
> +
> + if (c->dpy == NULL)
> + return NULL;
> +
> c->conn = XGetXCBConnection(c->dpy);
>
> if (xcb_connection_has_error(c->conn))
> --
> 1.7.4.1
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>
More information about the wayland-devel
mailing list