qcow2: fix two memory leaks in qcow2_open error code path
PATCH 1/1 qcow2: fix two memory leaks in qcow2_open error code path
Signed-off-by Prasad Joshi <[email protected]>
--- block/qcow2.c | 4 ++++ 1 file changed, 4 insertions(+)
block/qcow2.c +4 -0
@@ -506,6 +506,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags, s->incompatible_features & ~QCOW2_INCOMPAT_MASK); ret = -ENOTSUP ; +g_free (feature_table); goto fail; }
@@ -745,6 +746,9 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags,if (s->l2_table_cache) {qcow2_cache_destroy (bs, s->l2_table_cache); } +if (s->refcount_block_cache) { +qcow2_cache_destroy (bs, s->refcount_block_cache); + }g_free (s->cluster_cache);qemu_vfree (s->cluster_data);return ret;
Signature · 1 line
1.8.1.2
Quoted 18 lines · Prasad Joshi
Signed-off-by Prasad Joshi <[email protected]>--- block/qcow2.c | 4 ++++ 1 file changed, 4 insertions(+)block/qcow2.c +1
-0@@ -506,6 +506,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags, s->incompatible_features & ~QCOW2_INCOMPAT_MASK); ret = -ENOTSUP ; +g_free (feature_table); goto fail; }
block/qcow2.c static int qcow2_open(BlockDriverState *bs, QDict *options, int flags, · line 754
Quoted 9 lines
block/qcow2.c +3
-0@@ -745,6 +746,9 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags,if (s->l2_table_cache) {qcow2_cache_destroy (bs, s->l2_table_cache); } +if (s->refcount_block_cache) { +qcow2_cache_destroy (bs, s->refcount_block_cache); + }g_free (s->cluster_cache);qemu_vfree (s->cluster_data);return ret;
Reviewed-by Max Reitz <[email protected]>
Stefan Hajnoczi
AppliedQuoted 4 lines · Prasad Joshi
Signed-off-by Prasad Joshi <[email protected]>--- block/qcow2.c | 4 ++++ 1 file changed, 4 insertions(+)
Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block
Stefan