From 6d4f89b6a48072e49d8e62451a45fa0c346730de Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Thu, 11 Feb 2021 16:48:51 +0100 Subject: [PATCH] qmeventd: catch calloc error even if close to impossible to happen, NULL dereferences are never nice.. Signed-off-by: Thomas Lamprecht --- qmeventd/qmeventd.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/qmeventd/qmeventd.c b/qmeventd/qmeventd.c index 28363e49..e2ae8b28 100644 --- a/qmeventd/qmeventd.c +++ b/qmeventd/qmeventd.c @@ -353,6 +353,11 @@ void add_new_client(int client_fd) { struct Client *client = calloc(sizeof(struct Client), 1); + if (client == NULL) { + fprintf(stderr, "could not add new client - allocation failed!\n"); + fflush(stderr); + return; + } client->state = STATE_HANDSHAKE; client->type = CLIENT_NONE; client->fd = client_fd;