]> git.proxmox.com Git - qemu-server.git/commitdiff
qmeventd: catch calloc error
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 11 Feb 2021 15:48:51 +0000 (16:48 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 11 Feb 2021 15:48:53 +0000 (16:48 +0100)
even if close to impossible to happen, NULL dereferences are never
nice..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
qmeventd/qmeventd.c

index 28363e494aa91af364d6f026b3d04b7e8a277099..e2ae8b287452a5c9e430f846dd0bdc17d2650e29 100644 (file)
@@ -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;