From: Markus Ongyerth Date: Mon, 30 Apr 2018 09:35:50 +0000 (+0200) Subject: weston-info: destroy wl_keyboard X-Git-Tag: upstream/5.0.0~99 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=995bf51b2cc622762b7d9079f03ab46d4055cd37;p=platform%2Fupstream%2Fweston.git weston-info: destroy wl_keyboard Fixes a memory leak by calling wl_keyboard_destroy on any keyboard that was used to listen for events. Signed-off-by: Markus Ongyerth Acked-by: Pekka Paalanen Reviewed-by: Peter Hutterer --- diff --git a/clients/weston-info.c b/clients/weston-info.c index 6606117..609e270 100644 --- a/clients/weston-info.c +++ b/clients/weston-info.c @@ -118,6 +118,7 @@ struct seat_info { struct wl_seat *seat; struct weston_info *info; + struct wl_keyboard *keyboard; uint32_t capabilities; char *name; @@ -498,10 +499,8 @@ seat_handle_capabilities(void *data, struct wl_seat *wl_seat, return; if (caps & WL_SEAT_CAPABILITY_KEYBOARD) { - struct wl_keyboard *keyboard; - - keyboard = wl_seat_get_keyboard(seat->seat); - wl_keyboard_add_listener(keyboard, &keyboard_listener, + seat->keyboard = wl_seat_get_keyboard(seat->seat); + wl_keyboard_add_listener(seat->keyboard, &keyboard_listener, seat); seat->info->roundtrip_needed = true; @@ -531,6 +530,9 @@ destroy_seat_info(void *data) if (seat->name != NULL) free(seat->name); + if (seat->keyboard) + wl_keyboard_destroy(seat->keyboard); + wl_list_remove(&seat->global_link); }