From cf83b48be4bfa452f5ec9045d420f8ca7b38f713 Mon Sep 17 00:00:00 2001 From: bnlrnz Date: Fri, 6 Nov 2020 11:02:13 +0100 Subject: [PATCH] backend-headless: NULL check after wl_event_loop_add_timer Running weston with headless backend will segfault if wl_event_loop_add_timer fails Closes #102 Signed-off-by: Ben Lorenz --- libweston/backend-headless/headless.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libweston/backend-headless/headless.c b/libweston/backend-headless/headless.c index c312a0f2..7056df8f 100644 --- a/libweston/backend-headless/headless.c +++ b/libweston/backend-headless/headless.c @@ -255,6 +255,11 @@ headless_output_enable(struct weston_output *base) output->finish_frame_timer = wl_event_loop_add_timer(loop, finish_frame_handler, output); + if (output->finish_frame_timer == NULL) { + weston_log("failed to add finish frame timer\n"); + return -1; + } + switch (b->renderer_type) { case HEADLESS_GL: ret = headless_output_enable_gl(output);