From 58a33bd51c5f478b82155efe0942938084b3daca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Mon, 16 Dec 2013 22:52:05 +0100 Subject: [PATCH] Unref seats and devices in libinput_destroy() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jonas Ã…dahl --- src/libinput.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/libinput.c b/src/libinput.c index ebfb9289..1019e3cc 100644 --- a/src/libinput.c +++ b/src/libinput.c @@ -384,11 +384,22 @@ LIBINPUT_EXPORT void libinput_destroy(struct libinput *libinput) { struct libinput_event *event; + struct libinput_device *device, *next_device; + struct libinput_seat *seat, *next_seat; while ((event = libinput_get_event(libinput))) free(event); free(libinput->events); + list_for_each_safe(seat, next_seat, &libinput->seat_list, link) { + list_for_each_safe(device, next_device, + &seat->devices_list, + link) + libinput_device_unref(device); + + libinput_seat_unref(seat); + } + close(libinput->epoll_fd); free(libinput); }