From: Peter Hutterer Date: Fri, 22 Aug 2014 04:48:42 +0000 (+1000) Subject: evdev: plug memory leak on libevdev_new_from_fd failure X-Git-Tag: 0.6.0~24 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c6478bbeeb6ecc328710f5777e4c4d7596dd6904;p=platform%2Fupstream%2Flibinput.git evdev: plug memory leak on libevdev_new_from_fd failure Found by coverity. Signed-off-by: Peter Hutterer --- diff --git a/src/evdev.c b/src/evdev.c index b9f635db..b09bb989 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -885,10 +885,11 @@ evdev_device_create(struct libinput_seat *seat, return NULL; libinput_device_init(&device->base, seat); + libinput_seat_ref(seat); rc = libevdev_new_from_fd(fd, &device->evdev); if (rc != 0) - return NULL; + goto err; libevdev_set_clock_id(device->evdev, CLOCK_MONOTONIC); @@ -905,8 +906,6 @@ evdev_device_create(struct libinput_seat *seat, device->pending_event = EVDEV_NONE; device->devname = libevdev_get_name(device->evdev); - libinput_seat_ref(seat); - if (evdev_configure_device(device) == -1) goto err;