From 4ebd6f35070ba5a9a84f279dbe854613f415d468 Mon Sep 17 00:00:00 2001 From: Dan Robertson Date: Wed, 9 May 2018 16:32:55 +0000 Subject: [PATCH] Fix null deref in server_init If the backend fails to be created, log an error and immidiately return from server_init. --- sway/server.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sway/server.c b/sway/server.c index 2793ca70..8c41ee87 100644 --- a/sway/server.c +++ b/sway/server.c @@ -48,6 +48,10 @@ bool server_init(struct sway_server *server) { server->wl_event_loop = wl_display_get_event_loop(server->wl_display); server->backend = wlr_backend_autocreate(server->wl_display); + if (!server->backend) { + wlr_log(L_ERROR, "Unable to create backend"); + return false; + } struct wlr_renderer *renderer = wlr_backend_get_renderer(server->backend); assert(renderer);