aboutsummaryrefslogtreecommitdiff
path: root/block/qcow2-snapshot.c
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2013-10-09 10:51:04 +0200
committerKevin Wolf <kwolf@redhat.com>2013-10-11 16:49:59 +0200
commit37d41f0a04e5017d37906728a806d7944e867a2a (patch)
tree88691cba4cbbd2073fab239749c43152b1f59d4d /block/qcow2-snapshot.c
parent8f730dd24edd2576ecbd596de7ea4361296b129c (diff)
downloadqemu-37d41f0a04e5017d37906728a806d7944e867a2a.zip
qemu-37d41f0a04e5017d37906728a806d7944e867a2a.tar.gz
qemu-37d41f0a04e5017d37906728a806d7944e867a2a.tar.bz2
qcow2: Always use error path on writing snapshots
qcow2_write_snapshots does contain a fail label and there is no reason not to use it on some errors; therefore, we should always jump there on error. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/qcow2-snapshot.c')
-rw-r--r--block/qcow2-snapshot.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/block/qcow2-snapshot.c b/block/qcow2-snapshot.c
index 5e8a779..3337974 100644
--- a/block/qcow2-snapshot.c
+++ b/block/qcow2-snapshot.c
@@ -182,11 +182,12 @@ static int qcow2_write_snapshots(BlockDriverState *bs)
snapshots_offset = qcow2_alloc_clusters(bs, snapshots_size);
offset = snapshots_offset;
if (offset < 0) {
- return offset;
+ ret = offset;
+ goto fail;
}
ret = bdrv_flush(bs);
if (ret < 0) {
- return ret;
+ goto fail;
}
/* The snapshot list position has not yet been updated, so these clusters
@@ -194,7 +195,7 @@ static int qcow2_write_snapshots(BlockDriverState *bs)
ret = qcow2_pre_write_overlap_check(bs, QCOW2_OL_DEFAULT, offset,
snapshots_size);
if (ret < 0) {
- return ret;
+ goto fail;
}