aboutsummaryrefslogtreecommitdiff
path: root/block/qcow2-cluster.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2014-05-19 17:56:01 +0200
committerStefan Hajnoczi <stefanha@redhat.com>2014-05-28 14:28:46 +0200
commitbd60436936ecebf2c683eef9ea561f2b949700f3 (patch)
treea211604b6ad5f4b6c33cd170e4be0fca91265660 /block/qcow2-cluster.c
parent4ba6fabfb447661ee44ee593b2c454c7ffd1183f (diff)
downloadqemu-bd60436936ecebf2c683eef9ea561f2b949700f3.zip
qemu-bd60436936ecebf2c683eef9ea561f2b949700f3.tar.gz
qemu-bd60436936ecebf2c683eef9ea561f2b949700f3.tar.bz2
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 <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block/qcow2-cluster.c')
-rw-r--r--block/qcow2-cluster.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
index 76d2bcf..4208dc0 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