From d4a8a06a98cc5bba9c7066b3e843c44254eeccf6 Mon Sep 17 00:00:00 2001 From: Alastair Hughes Date: Thu, 7 Jun 2018 20:27:42 +1200 Subject: [PATCH] weston: catch wl_display_create failures Avoid a null dereference if wl_display_create fails, for instance if epoll is not compiled into the kernel. Fixes https://bugs.freedesktop.org/show_bug.cgi?id=106122 Signed-off-by: Alastair Hughes --- compositor/main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/compositor/main.c b/compositor/main.c index e84857f7..068910f7 100644 --- a/compositor/main.c +++ b/compositor/main.c @@ -1957,6 +1957,10 @@ int main(int argc, char *argv[]) verify_xdg_runtime_dir(); display = wl_display_create(); + if (display == NULL) { + weston_log("fatal: failed to create display\n"); + goto out_display; + } loop = wl_display_get_event_loop(display); signals[0] = wl_event_loop_add_signal(loop, SIGTERM, on_term_signal, @@ -2120,6 +2124,7 @@ out_signals: wl_display_destroy(display); +out_display: weston_log_file_close(); if (config) -- 2.17.1