libuwac/input: Fix memory leak
`create_pointer_buffer()` allocates memory with `mmap` and never frees it. Adding a corresponding `munmap` fixes this issue.
This commit is contained in:
parent
9379f93034
commit
ff618f53f7
@ -26,6 +26,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/mman.h>
|
||||
@ -69,6 +70,10 @@ static struct wl_buffer* create_pointer_buffer(UwacSeat* seat, const void* src,
|
||||
seat->pointer_image->width * 4, WL_SHM_FORMAT_ARGB8888);
|
||||
wl_shm_pool_destroy(pool);
|
||||
|
||||
if (munmap(data, size) < 0)
|
||||
fprintf(stderr, "%s: munmap(%p, %" PRIuz ") failed with [%d] %s\n", __FUNCTION__, data,
|
||||
size, errno, strerror(errno));
|
||||
|
||||
error_mmap:
|
||||
close(fd);
|
||||
return buffer;
|
||||
|
Loading…
x
Reference in New Issue
Block a user