mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-24 19:20:05 +01:00
Don't close the fd if libinput_add_fd() fails
Let the caller decide what to do with the fd. In the current code the caller can't know if the fd was closed on error since we return NULL on malloc failure as well as on epoll_ctl() failure. In the latter case the fd was closed, not in the former. The caller had to close the fd anyway (and all three callers do), so drop closing the fd from this function. Found by Coverity. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
c6478bbeeb
commit
0b26f2592c
1 changed files with 0 additions and 1 deletions
|
|
@ -457,7 +457,6 @@ libinput_add_fd(struct libinput *libinput,
|
|||
ep.data.ptr = source;
|
||||
|
||||
if (epoll_ctl(libinput->epoll_fd, EPOLL_CTL_ADD, fd, &ep) < 0) {
|
||||
close(source->fd);
|
||||
free(source);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue