From: Prasad Joshi Date: Fri, 28 Mar 2014 17:38:58 +0000 (+0530) Subject: qcow2: fix two memory leaks in qcow2_open error code path X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=c5a33ee9eee031c9bae362b9bd7045cd8ff24d86;p=qemu.git qcow2: fix two memory leaks in qcow2_open error code path Signed-off-by: Prasad Joshi Reviewed-by: Max Reitz Signed-off-by: Stefan Hajnoczi --- diff --git a/block/qcow2.c b/block/qcow2.c index b9dc960bd1..10eccf91e1 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -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;