From: Jens Axboe Date: Thu, 22 Mar 2018 00:58:22 +0000 (-0600) Subject: server: handle shared mem pool allocation failures X-Git-Tag: fio-3.6~29 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=e3500d9977d5643527f9a56e92b16df6b78c0222;p=fio.git server: handle shared mem pool allocation failures Signed-off-by: Jens Axboe --- diff --git a/server.c b/server.c index 6064d817..72d7b0a1 100644 --- a/server.c +++ b/server.c @@ -528,6 +528,9 @@ static struct sk_entry *fio_net_prep_cmd(uint16_t opcode, void *buf, struct sk_entry *entry; entry = smalloc(sizeof(*entry)); + if (!entry) + return NULL; + INIT_FLIST_HEAD(&entry->next); entry->opcode = opcode; if (flags & SK_F_COPY) { @@ -1359,6 +1362,11 @@ static int accept_loop(int listen_sk) dprint(FD_NET, "server: connect from %s\n", from); sk_out = smalloc(sizeof(*sk_out)); + if (!sk_out) { + close(sk); + return -1; + } + sk_out->sk = sk; INIT_FLIST_HEAD(&sk_out->list); __fio_sem_init(&sk_out->lock, FIO_SEM_UNLOCKED);