diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c index 2661493a7d8c1b3ee90fb7bddf4812000b117abc..95491d338855ea6de55a0c12094515ce3339dc2c 100644 --- a/block/qcow2-refcount.c +++ b/block/qcow2-refcount.c @@ -556,8 +556,8 @@ static int64_t alloc_clusters_noref(BlockDriverState *bs, int64_t size) nb_clusters = size_to_clusters(s, size); retry: for(i = 0; i < nb_clusters; i++) { - int64_t i = s->free_cluster_index++; - if (get_refcount(bs, i) != 0) + int64_t next_cluster_index = s->free_cluster_index++; + if (get_refcount(bs, next_cluster_index) != 0) goto retry; } #ifdef DEBUG_ALLOC2