summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2014-02-08 17:44:59 +0100
committerKevin Wolf <kwolf@redhat.com>2014-04-04 17:10:08 +0200
commit8885eadedd0ea8b57c1baa367ee2c2d616700bd9 (patch)
treec65ba59e0ddb57ff2eae890d436f8f505461fb65 /block
parent4c2e5f8f46a17966dc45b5a3e07b97434c0eabdf (diff)
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 <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/qcow2-cluster.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
index 60a6910b1..331ab0802 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,