From 7eb58a6c556c3880e6712cbf6d24d681261c5095 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Tue, 6 Apr 2010 18:24:07 +0200 Subject: [PATCH] block: Fix multiwrite memory leak in error case Previously multiwrite_user_cb was never called if a request in the multiwrite batch failed right away because it did set mcb->error immediately. Make it look more like a normal callback to fix this. Reported-by: Juan Quintela Signed-off-by: Kevin Wolf Signed-off-by: Aurelien Jarno --- block.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block.c b/block.c index 1027ff7c5d..0881c93cf9 100644 --- a/block.c +++ b/block.c @@ -1884,7 +1884,8 @@ int bdrv_aio_multiwrite(BlockDriverState *bs, BlockRequest *reqs, int num_reqs) reqs[i].error = -EIO; goto fail; } else { - mcb->error = -EIO; + mcb->num_requests++; + multiwrite_cb(mcb, -EIO); break; } } else { -- 2.11.4.GIT