aboutsummaryrefslogtreecommitdiff
path: root/block/qcow2-refcount.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2009-10-15 17:31:01 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-10-27 12:28:35 -0500
commitc5baaa489f5557fa01431ba0c5de28b43fc9631e (patch)
tree156066310c1c2e9f192c11c79fbbaf7cc92eb393 /block/qcow2-refcount.c
parentdcc7e25fd18e453168c8f2e59b50a335d0a9346a (diff)
qcow2: Fix grow_refcount_table error handling
In case of failure, we haven't increased the refcount for the newly allocated cluster yet. Therefore we must not free the cluster or its refcount will become negative (and endless recursion is possible). Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'block/qcow2-refcount.c')
-rw-r--r--block/qcow2-refcount.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index 609eee1891..30266786df 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -182,7 +182,6 @@ static int grow_refcount_table(BlockDriverState *bs, int min_size)
qcow2_free_clusters(bs, old_table_offset, old_table_size * sizeof(uint64_t));
return 0;
fail:
- qcow2_free_clusters(bs, table_offset, new_table_size2);
qemu_free(new_table);
return -EIO;
}