From 8885eadedd0ea8b57c1baa367ee2c2d616700bd9 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Sat, 8 Feb 2014 17:44:59 +0100 Subject: qcow2: Put cache reference in error case When qcow2_get_cluster_offset() sees a zero cluster in a version 2 image, it (rightfully) returns an error. But in doing so it shouldn't leak an L2 table cache reference. Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz --- block/qcow2-cluster.c | 1 + 1 file changed, 1 insertion(+) (limited to 'block') diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c index 60a6910b1e..331ab08022 100644 --- a/block/qcow2-cluster.c +++ b/block/qcow2-cluster.c @@ -491,6 +491,7 @@ int qcow2_get_cluster_offset(BlockDriverState *bs, uint64_t offset, break; case QCOW2_CLUSTER_ZERO: if (s->qcow_version < 3) { + qcow2_cache_put(bs, s->l2_table_cache, (void**) &l2_table); return -EIO; } c = count_contiguous_clusters(nb_clusters, s->cluster_size, -- cgit v1.2.1