Memory leak caused by libinput_udev_assign_seat
Summary
When using libinput_udev_assign_seat
I get the following memory leak:
=================================================================
==125549==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 56 byte(s) in 1 object(s) allocated from:
#0 0x7f0fd5d06cd8 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cc:153
#1 0x7f0fd5bcdc33 (/usr/lib/libinput.so.10+0x20c33)
SUMMARY: AddressSanitizer: 56 byte(s) leaked in 1 allocation(s).
Might be related to #270
Steps to reproduce
Compiling and running the following code with -fsanitize=address
in g++ 9.2 consistently gives me the error message above.
#include <fcntl.h>
#include <libinput.h>
#include <unistd.h>
int open_restricted(const char *path, int flags, void *)
{
return open(path, flags);
}
void close_restricted(int fd, void *)
{
close(fd);
}
const struct libinput_interface interface = {open_restricted, close_restricted};
int main(void)
{
auto udev = udev_new();
auto li = libinput_udev_create_context(&interface, nullptr, udev);
libinput_udev_assign_seat(li, "seat0");
libinput_unref(li);
udev_unref(udev);
}
libinput version you encountered the bug on
1.15.0
Hardware information:
XPS 13 7390 2-in-1 Notebook
Other log output:
None