aboutsummaryrefslogtreecommitdiff
path: root/seatd
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2021-10-23 14:27:39 +0000
committerKenny Levinsen <kl@kl.wtf>2022-03-29 20:07:47 +0200
commit85d0bf594362bf5d85b191711e6fc2a51f6bd21a (patch)
treeb6284204c4284a60e616eae0692deeeedb2ce6db /seatd
parent8f8c9558e6279060f3ccc3363cb3558ffc9efd84 (diff)
seatd: handle client_create failure
Failure to create the client causes a null pointer dereference.
Diffstat (limited to 'seatd')
-rw-r--r--seatd/server.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/seatd/server.c b/seatd/server.c
index 8ead54d..47d6e91 100644
--- a/seatd/server.c
+++ b/seatd/server.c
@@ -129,6 +129,12 @@ int server_add_client(struct server *server, int fd) {
}
struct client *client = client_create(server, fd);
+ if (client == NULL) {
+ log_errorf("Could not create client: %s", strerror(errno));
+ close(fd);
+ return -1;
+ }
+
client->event_source =
poller_add_fd(&server->poller, fd, EVENT_READABLE, client_handle_connection, client);
if (client->event_source == NULL) {