From patchwork Tue Apr 6 16:24:07 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [2/2] block: Fix multiwrite memory leak in error case Date: Tue, 06 Apr 2010 06:24:07 -0000 From: Kevin Wolf X-Patchwork-Id: 49529 Message-Id: <1270571047-1208-3-git-send-email-kwolf@redhat.com> To: qemu-devel@nongnu.org Cc: kwolf@redhat.com 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 --- block.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/block.c b/block.c index ae5aba3..ed4c819 100644 --- a/block.c +++ b/block.c @@ -1893,7 +1893,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 {