[PATCH] qcow2: fix memory leak in qcow2_read_extensions

luzhipeng posted 1 patch 1 year, 7 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20220921144515.1166-1-luzhipeng@cestc.cn
Maintainers: Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>
block/qcow2.c | 1 +
1 file changed, 1 insertion(+)
[PATCH] qcow2: fix memory leak in qcow2_read_extensions
Posted by luzhipeng 1 year, 7 months ago
From: lu zhipeng <luzhipeng@cestc.cn>

Free feature_table if it is failed in bdrv_pread.

Signed-off-by: lu zhipeng <luzhipeng@cestc.cn>
---
 block/qcow2.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/block/qcow2.c b/block/qcow2.c
index c6c6692fb7..c8fc3a6160 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -275,6 +275,7 @@ static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset,
                 if (ret < 0) {
                     error_setg_errno(errp, -ret, "ERROR: ext_feature_table: "
                                      "Could not read table");
+                    g_free(feature_table);
                     return ret;
                 }
 
-- 
2.31.1
Re: [PATCH] qcow2: fix memory leak in qcow2_read_extensions
Posted by Kevin Wolf 1 year, 7 months ago
Am 21.09.2022 um 16:45 hat luzhipeng geschrieben:
> From: lu zhipeng <luzhipeng@cestc.cn>
> 
> Free feature_table if it is failed in bdrv_pread.
> 
> Signed-off-by: lu zhipeng <luzhipeng@cestc.cn>

Thanks, applied to the block branch.

Kevin