drm-shim: Avoid assertion fail if someone does close(-1).

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23116>
This commit is contained in:
Emma Anholt
2023-05-18 16:21:44 -07:00
committed by Marge Bot
parent b9dd13e1b3
commit d261c425ff

View File

@@ -147,6 +147,9 @@ static void handle_delete_fxn(struct hash_entry *entry)
void drm_shim_fd_unregister(int fd)
{
if (fd == -1)
return;
struct hash_entry *entry =
_mesa_hash_table_search(shim_device.fd_map, (void *)(uintptr_t)(fd + 1));
if (!entry)