mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-10-29 05:40:16 -04:00
wayland-client: Avoid null dereference when handling deletion
If an unknown id is deleted then the lookup in the map will return NULL and so we should avoid dereferencing that. As this is unexpected behaviour log a message about the problem too.
This commit is contained in:
parent
477dcd84c7
commit
9fbcc7ae7d
1 changed files with 5 additions and 1 deletions
|
|
@ -415,7 +415,11 @@ display_handle_delete_id(void *data, struct wl_display *display, uint32_t id)
|
|||
pthread_mutex_lock(&display->mutex);
|
||||
|
||||
proxy = wl_map_lookup(&display->objects, id);
|
||||
if (proxy != WL_ZOMBIE_OBJECT)
|
||||
|
||||
if (!proxy)
|
||||
wl_log("error: received delete_id for unknown id (%u)\n", id);
|
||||
|
||||
if (proxy && proxy != WL_ZOMBIE_OBJECT)
|
||||
proxy->flags |= WL_PROXY_FLAG_ID_DELETED;
|
||||
else
|
||||
wl_map_remove(&display->objects, id);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue