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 <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2014-09-15 15:43:14 -04:00
parent cc23711651
commit d91e607dd6
1 changed files with 10 additions and 7 deletions

View File

@ -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);
}