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 <derek.foreman@collabora.com>
This commit is contained in:
Derek Foreman 2022-01-18 16:50:39 -06:00 committed by Daniel Stone
parent 6c2646e967
commit c826d8fa0d

View file

@ -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);