aboutsummaryrefslogtreecommitdiff
path: root/nbd/server.c
diff options
context:
space:
mode:
Diffstat (limited to 'nbd/server.c')
-rw-r--r--nbd/server.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/nbd/server.c b/nbd/server.c
index c41af0debe..eead339a2c 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -836,7 +836,11 @@ static ssize_t nbd_co_receive_request(NBDRequest *req, struct nbd_request *reque
goto out;
}
- req->data = blk_blockalign(client->exp->blk, request->len);
+ req->data = blk_try_blockalign(client->exp->blk, request->len);
+ if (req->data == NULL) {
+ rc = -ENOMEM;
+ goto out;
+ }
}
if (command == NBD_CMD_WRITE) {
TRACE("Reading %u byte(s)", request->len);