mirror of
https://gitlab.freedesktop.org/libinput/libei.git
synced 2026-05-15 12:48:07 +02:00
eis: fix two file descriptor leaks on error
Assisted-by: Claude:claude-opus-4-6 Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/388>
This commit is contained in:
parent
62ac026432
commit
c436bd37ec
2 changed files with 9 additions and 1 deletions
|
|
@ -28,6 +28,7 @@
|
|||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
|
||||
#include "util-io.h"
|
||||
#include "util-macros.h"
|
||||
#include "util-mem.h"
|
||||
#include "util-sources.h"
|
||||
|
|
@ -83,8 +84,11 @@ eis_backend_fd_add_client(struct eis *eis)
|
|||
return -errno;
|
||||
|
||||
struct eis_client *client = eis_client_new(eis, fds[0]);
|
||||
if (client == NULL)
|
||||
if (client == NULL) {
|
||||
xclose(fds[0]);
|
||||
xclose(fds[1]);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
eis_client_unref(client);
|
||||
|
||||
|
|
|
|||
|
|
@ -115,6 +115,10 @@ listener_dispatch(struct source *source, void *data)
|
|||
return;
|
||||
|
||||
struct eis_client *client = eis_client_new(eis, fd);
|
||||
if (client == NULL) {
|
||||
xclose(fd);
|
||||
return;
|
||||
}
|
||||
eis_client_unref(client);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue