]> xenbits.xensource.com Git - qemu-upstream-4.6-testing.git/commitdiff
qcow2: Fix memory leak in COW error path
authorKevin Wolf <kwolf@redhat.com>
Mon, 19 May 2014 15:56:01 +0000 (17:56 +0200)
committerStefan Hajnoczi <stefanha@redhat.com>
Wed, 28 May 2014 12:28:46 +0000 (14:28 +0200)
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>
block/qcow2-cluster.c

index 76d2bcf63ad540288df623f683b03c100cda7a02..4208dc08b5633153ceb51957bcc0ad3d28f5c125 100644 (file)
@@ -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