From 52776d0d5aaf7899ef1462f61570dc321baff4af Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 7 Aug 2013 11:04:47 +1000 Subject: [PATCH] evdev: plug a potential memleak For touchpads, device->dispatch is set up when exiting evdev_handle_device() and a potential source for a memleak. This can't actually happen at the moment, as evdev_handle_device() won't fail for touchpads after setting up the dispatch but prevent this from happening in the future. --- src/evdev.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/evdev.c b/src/evdev.c index 999ab8e6f..2cb3432e6 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -594,6 +594,8 @@ evdev_device_create(struct weston_seat *seat, const char *path, int device_fd) device->devname = strdup(devname); if (!evdev_handle_device(device)) { + if (device->dispatch) + device->dispatch->interface->destroy(dispatch); if (device->mtdev) mtdev_close_delete(device->mtdev); free(device->devnode);