uwac: Do not return destroyed UwacSeat

This is needed to fix the following defects reported by Covscan:
use_after_free: Using freed pointer "seat".
warning: Value stored to 'seat' is never read

This is follow up for https://github.com/FreeRDP/FreeRDP/pull/4970

https://github.com/FreeRDP/FreeRDP/issues/4820
This commit is contained in:
Ondrej Holy 2018-12-13 09:47:26 +01:00
parent 3d4b195c40
commit 24cdcbccc7

View File

@ -126,7 +126,7 @@ static const struct _wl_fullscreen_shell_listener fullscreen_shell_listener =
#endif #endif
static UwacSeat* display_destroy_seat(UwacDisplay* d, uint32_t name) static void display_destroy_seat(UwacDisplay* d, uint32_t name)
{ {
UwacSeat* seat; UwacSeat* seat;
wl_list_for_each(seat, &d->seats, link) wl_list_for_each(seat, &d->seats, link)
@ -134,10 +134,8 @@ static UwacSeat* display_destroy_seat(UwacDisplay* d, uint32_t name)
if (seat->seat_id == name) if (seat->seat_id == name)
{ {
UwacSeatDestroy(seat); UwacSeatDestroy(seat);
return seat;
} }
} }
return NULL;
} }
static void registry_handle_global(void* data, struct wl_registry* registry, uint32_t id, static void registry_handle_global(void* data, struct wl_registry* registry, uint32_t id,
@ -265,8 +263,8 @@ static void registry_handle_global_remove(void* data, struct wl_registry* regist
if (strcmp(global->interface, "wl_seat") == 0) if (strcmp(global->interface, "wl_seat") == 0)
{ {
UwacSeatRemovedEvent* ev; UwacSeatRemovedEvent* ev;
UwacSeat* seat;
seat = display_destroy_seat(d, name); display_destroy_seat(d, name);
ev = (UwacSeatRemovedEvent*)UwacDisplayNewEvent(d, UWAC_EVENT_REMOVED_SEAT); ev = (UwacSeatRemovedEvent*)UwacDisplayNewEvent(d, UWAC_EVENT_REMOVED_SEAT);
if (ev) if (ev)