From 99e6cba3c307396e95ef1a4034c701db88b187ce Mon Sep 17 00:00:00 2001 From: Dan Robertson Date: Sun, 25 Feb 2018 02:26:56 +0000 Subject: [PATCH] Fix null deref in wlr_libinput_backend_destroy If input_event is null (e.g. if backend_start has not been called yet) wl_event_source_remove will result in a null deref. --- backend/libinput/backend.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/libinput/backend.c b/backend/libinput/backend.c index 71fe0d93..1e7c1ad4 100644 --- a/backend/libinput/backend.c +++ b/backend/libinput/backend.c @@ -118,7 +118,9 @@ static void wlr_libinput_backend_destroy(struct wlr_backend *wlr_backend) { wl_list_remove(&backend->session_signal.link); wlr_list_finish(&backend->wlr_device_lists); - wl_event_source_remove(backend->input_event); + if (backend->input_event) { + wl_event_source_remove(backend->input_event); + } libinput_unref(backend->libinput_context); free(backend); }