vulkan/wsi/wayland: Fix use after free

In 7eaceb0392 I called pthread_mutex_unlock() with a member of a freed
structure.

We can unlock as soon as this element is removed from the list it was in,
so just move the unlock to before the free.

Fixes 7eaceb0392

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28432>
This commit is contained in:
Derek Foreman
2024-03-27 12:00:37 -05:00
committed by Marge Bot
parent 74615bb704
commit 642d32045f
+1 -1
View File
@@ -1929,8 +1929,8 @@ wsi_wl_presentation_update_present_id(struct wsi_wl_present_id *id)
id->chain->present_ids.max_completed = id->present_id;
wl_list_remove(&id->link);
vk_free(id->alloc, id);
pthread_mutex_unlock(&id->chain->present_ids.lock);
vk_free(id->alloc, id);
}
static void