From c448819b374021b72452a7d1bdababeae5d2c290 Mon Sep 17 00:00:00 2001
From: Philipp Zabel
Date: Wed, 30 Nov 2022 14:05:14 +0100
Subject: [PATCH] backend-wayland: do not try to release uninitialized seat
Do not call weston_seat_release() if Weston aborts before
weston_seat_init() could be called. This fixes a possible
segfault due to uninitialized list traversal in the error
path.
Signed-off-by: Philipp Zabel
---
libweston/backend-wayland/wayland.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libweston/backend-wayland/wayland.c b/libweston/backend-wayland/wayland.c
index 8a5a1e54e..58533eb1b 100644
--- a/libweston/backend-wayland/wayland.c
+++ b/libweston/backend-wayland/wayland.c
@@ -2430,7 +2430,8 @@ wayland_input_destroy(struct wayland_input *input)
if (input->touch_device)
weston_touch_device_destroy(input->touch_device);
- weston_seat_release(&input->base);
+ if (input->seat_initialized)
+ weston_seat_release(&input->base);
if (input->parent.keyboard) {
if (input->seat_version >= WL_KEYBOARD_RELEASE_SINCE_VERSION)