summaryrefslogtreecommitdiff
path: root/block/qcow2.c
diff options
context:
space:
mode:
authorPrasad Joshi <prasadjoshi.linux@gmail.com>2014-03-28 23:08:58 +0530
committerStefan Hajnoczi <stefanha@redhat.com>2014-04-01 13:49:53 +0200
commitc5a33ee9eee031c9bae362b9bd7045cd8ff24d86 (patch)
treed87c0a23db7699f44bf7c987d2732d28860e9df1 /block/qcow2.c
parent4c7096607d0378de8d999c996802a73e601b2722 (diff)
downloadqemu-c5a33ee9eee031c9bae362b9bd7045cd8ff24d86.tar.gz
qemu-c5a33ee9eee031c9bae362b9bd7045cd8ff24d86.tar.bz2
qemu-c5a33ee9eee031c9bae362b9bd7045cd8ff24d86.zip
qcow2: fix two memory leaks in qcow2_open error code path
Signed-off-by: Prasad Joshi <prasadjoshi.linux@gmail.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block/qcow2.c')
-rw-r--r--block/qcow2.c4
1 files changed, 4 insertions, 0 deletions
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;