From d91e607dd63da0a0d2a7de832ce1e5455a6fa878 Mon Sep 17 00:00:00 2001 From: Chris Michael Date: Mon, 15 Sep 2014 15:43:14 -0400 Subject: [PATCH] ecore-drm: Fix missing close of fd on _device_add If we failed to create an evdev device for an input, we should also be closing the fd before we return @fix Signed-off-by: Chris Michael --- src/lib/ecore_drm/ecore_drm_inputs.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/lib/ecore_drm/ecore_drm_inputs.c b/src/lib/ecore_drm/ecore_drm_inputs.c index 9879209..0320fdc 100644 --- a/src/lib/ecore_drm/ecore_drm_inputs.c +++ b/src/lib/ecore_drm/ecore_drm_inputs.c @@ -61,7 +61,11 @@ _device_add(Ecore_Drm_Input *input, struct udev_device *device) /* DBG("Opened Restricted Input: %s %d", node, fd); */ if (!(edev = _ecore_drm_evdev_device_create(seat, node, fd))) - return EINA_FALSE; + { + ERR("Could not create evdev device: %s", node); + close(fd); + return EINA_FALSE; + } seat->devices = eina_list_append(seat->devices, edev); @@ -304,14 +308,13 @@ ecore_drm_inputs_disable(Ecore_Drm_Input *input) { if (!input) return; - udev_monitor_unref(input->monitor); + if (input->monitor) udev_monitor_unref(input->monitor); input->monitor = NULL; - if (input->hdlr) - { - ecore_main_fd_handler_del(input->hdlr); - input->hdlr = NULL; - } + if (input->hdlr) ecore_main_fd_handler_del(input->hdlr); + input->hdlr = NULL; + input->enabled = EINA_FALSE; + input->suspended = EINA_TRUE; ecore_drm_inputs_destroy(input->dev); } -- 2.7.4