mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-05-09 02:28:05 +02:00
Drop the destroyed sources list on libinput_destroy()
==2772== 40 bytes in 1 blocks are definitely lost in loss record 3 of 4 ==2772== at 0x4A0645D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==2772== by 0x405EC7: libinput_add_fd (libinput.c:335) ==2772== by 0x40B346: udev_input_enable (udev-seat.c:268) ==2772== by 0x40B5E7: libinput_create_from_udev (udev-seat.c:369) Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
4e67b6da39
commit
cd6a65bf37
1 changed files with 15 additions and 4 deletions
|
|
@ -393,6 +393,16 @@ libinput_device_destroy(struct libinput_device *device);
|
||||||
static void
|
static void
|
||||||
libinput_seat_destroy(struct libinput_seat *seat);
|
libinput_seat_destroy(struct libinput_seat *seat);
|
||||||
|
|
||||||
|
static void
|
||||||
|
libinput_drop_destroyed_sources(struct libinput *libinput)
|
||||||
|
{
|
||||||
|
struct libinput_source *source, *next;
|
||||||
|
|
||||||
|
list_for_each_safe(source, next, &libinput->source_destroy_list, link)
|
||||||
|
free(source);
|
||||||
|
list_init(&libinput->source_destroy_list);
|
||||||
|
}
|
||||||
|
|
||||||
LIBINPUT_EXPORT void
|
LIBINPUT_EXPORT void
|
||||||
libinput_destroy(struct libinput *libinput)
|
libinput_destroy(struct libinput *libinput)
|
||||||
{
|
{
|
||||||
|
|
@ -405,6 +415,9 @@ libinput_destroy(struct libinput *libinput)
|
||||||
|
|
||||||
while ((event = libinput_get_event(libinput)))
|
while ((event = libinput_get_event(libinput)))
|
||||||
libinput_event_destroy(event);
|
libinput_event_destroy(event);
|
||||||
|
|
||||||
|
libinput_drop_destroyed_sources(libinput);
|
||||||
|
|
||||||
free(libinput->events);
|
free(libinput->events);
|
||||||
|
|
||||||
list_for_each_safe(seat, next_seat, &libinput->seat_list, link) {
|
list_for_each_safe(seat, next_seat, &libinput->seat_list, link) {
|
||||||
|
|
@ -569,7 +582,7 @@ libinput_get_fd(struct libinput *libinput)
|
||||||
LIBINPUT_EXPORT int
|
LIBINPUT_EXPORT int
|
||||||
libinput_dispatch(struct libinput *libinput)
|
libinput_dispatch(struct libinput *libinput)
|
||||||
{
|
{
|
||||||
struct libinput_source *source, *next;
|
struct libinput_source *source;
|
||||||
struct epoll_event ep[32];
|
struct epoll_event ep[32];
|
||||||
int i, count;
|
int i, count;
|
||||||
|
|
||||||
|
|
@ -585,9 +598,7 @@ libinput_dispatch(struct libinput *libinput)
|
||||||
source->dispatch(source->user_data);
|
source->dispatch(source->user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
list_for_each_safe(source, next, &libinput->source_destroy_list, link)
|
libinput_drop_destroyed_sources(libinput);
|
||||||
free(source);
|
|
||||||
list_init(&libinput->source_destroy_list);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue