aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
Diffstat (limited to 'block')
-rw-r--r--block/qcow2-cluster.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
index 8982b7b..dc3c270 100644
--- a/block/qcow2-cluster.c
+++ b/block/qcow2-cluster.c
@@ -1015,8 +1015,11 @@ err:
void qcow2_alloc_cluster_abort(BlockDriverState *bs, QCowL2Meta *m)
{
BDRVQcow2State *s = bs->opaque;
- qcow2_free_clusters(bs, m->alloc_offset, m->nb_clusters << s->cluster_bits,
- QCOW2_DISCARD_NEVER);
+ if (!has_data_file(bs)) {
+ qcow2_free_clusters(bs, m->alloc_offset,
+ m->nb_clusters << s->cluster_bits,
+ QCOW2_DISCARD_NEVER);
+ }
}
/*