From c826d8fa0d00c880436982d7e752339495e10549 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Tue, 18 Jan 2022 16:50:39 -0600 Subject: [PATCH] xwayland: Fix user after free on shutdown We need to remove our listener link before we free the structure it's inside, or the signal list walk will try to dereference it. Remove the improbable NULL check at the same time. Signed-off-by: Derek Foreman --- xwayland/launcher.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/xwayland/launcher.c b/xwayland/launcher.c index 60854c8a..7702b4fb 100644 --- a/xwayland/launcher.c +++ b/xwayland/launcher.c @@ -224,8 +224,7 @@ weston_xserver_destroy(struct wl_listener *l, void *data) struct weston_xserver *wxs = container_of(l, struct weston_xserver, destroy_listener); - if (!wxs) - return; + wl_list_remove(&wxs->destroy_listener.link); if (wxs->loop) weston_xserver_shutdown(wxs);