From: Kevin Wolf Date: Mon, 19 May 2014 15:56:01 +0000 (+0200) Subject: qcow2: Fix memory leak in COW error path X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=bd60436936ecebf2c683eef9ea561f2b949700f3;p=qemu.git qcow2: Fix memory leak in COW error path This triggers if bs->drv becomes NULL in a concurrent request. This is currently only the case when corruption prevention kicks in (i.e. at most once per image, and after that it produces I/O errors). Signed-off-by: Kevin Wolf Signed-off-by: Stefan Hajnoczi --- diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c index 76d2bcf63a..4208dc08b5 100644 --- a/block/qcow2-cluster.c +++ b/block/qcow2-cluster.c @@ -379,7 +379,8 @@ static int coroutine_fn copy_sectors(BlockDriverState *bs, BLKDBG_EVENT(bs->file, BLKDBG_COW_READ); if (!bs->drv) { - return -ENOMEDIUM; + ret = -ENOMEDIUM; + goto out; } /* Call .bdrv_co_readv() directly instead of using the public block-layer