summaryrefslogtreecommitdiff
path: root/server.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2018-03-21 18:58:22 -0600
committerJens Axboe <axboe@kernel.dk>2018-03-21 18:58:22 -0600
commite3500d9977d5643527f9a56e92b16df6b78c0222 (patch)
tree5fe2e2469461c5bdc19a026c809c971777899c46 /server.c
parentb647a293d70949b8c401772936a8000d10eb1bb9 (diff)
downloadfio-e3500d9977d5643527f9a56e92b16df6b78c0222.tar.gz
fio-e3500d9977d5643527f9a56e92b16df6b78c0222.tar.bz2
server: handle shared mem pool allocation failures
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'server.c')
-rw-r--r--server.c8
1 files changed, 8 insertions, 0 deletions
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);