]> git.proxmox.com Git - mirror_qemu.git/commitdiff
qcow2: Fix snapshot restoration in snapshot_create
authorMax Reitz <mreitz@redhat.com>
Wed, 9 Oct 2013 12:42:00 +0000 (14:42 +0200)
committerKevin Wolf <kwolf@redhat.com>
Fri, 11 Oct 2013 14:50:00 +0000 (16:50 +0200)
If the new snapshot table could not be written in qcow2_snapshot_create,
the old snapshot table has to be restored in memory and the new one
released. This should include restoration of the old snapshot count as
well, which is added by this patch.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/qcow2-snapshot.c

index 812dab2aa5d32b5e6caedae28915b2de6549a4e8..fe7e14cc895106255a6e94f4b0940eb4c9d76d43 100644 (file)
@@ -433,6 +433,7 @@ int qcow2_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info)
     if (ret < 0) {
         g_free(s->snapshots);
         s->snapshots = old_snapshot_list;
+        s->nb_snapshots--;
         goto fail;
     }