From 82634d2b69950e7e9a066c8c96bf2624ac26193a Mon Sep 17 00:00:00 2001 From: Jon TURNEY Date: Mon, 9 Feb 2015 13:45:44 +0000 Subject: [PATCH] ephyr: Avoid a segfault with 'DISPLAY= Xephyr -glamor' ephyr_glamor_connect() returns NULL if we failed, but applying xcb_connection_has_error() to NULL is not permitted. Signed-off-by: Jon TURNEY Signed-off-by: Eric Anholt Reviewed-by: Daniel Martin --- hw/kdrive/ephyr/hostx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c index 506a852b8..c67ff60d3 100644 --- a/hw/kdrive/ephyr/hostx.c +++ b/hw/kdrive/ephyr/hostx.c @@ -443,7 +443,7 @@ hostx_init(void) else #endif HostX.conn = xcb_connect(NULL, &HostX.screen); - if (xcb_connection_has_error(HostX.conn)) { + if (!HostX.conn || xcb_connection_has_error(HostX.conn)) { fprintf(stderr, "\nXephyr cannot open host display. Is DISPLAY set?\n"); exit(1); }