qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 1/2] qcow2: Fix memory leak in copy_sectors()


From: Max Reitz
Subject: [Qemu-devel] [PATCH 1/2] qcow2: Fix memory leak in copy_sectors()
Date: Thu, 29 May 2014 00:19:53 +0200

If bs->drv is NULL, iov.iov_base should not be leaked.

Signed-off-by: Max Reitz <address@hidden>
---
 block/qcow2-cluster.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
index 33e6826..d391c5a 100644
--- a/block/qcow2-cluster.c
+++ b/block/qcow2-cluster.c
@@ -387,7 +387,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
-- 
1.9.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]