From: Max Reitz Date: Wed, 9 Oct 2013 12:42:00 +0000 (+0200) Subject: qcow2: Fix snapshot restoration in snapshot_create X-Git-Tag: qemu-xen-4.5.0-rc1~425^2~38 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=84757f7e67cda3df8b04e06fbdeecc266415d2f3;p=qemu-upstream-4.5-testing.git qcow2: Fix snapshot restoration in snapshot_create 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 Signed-off-by: Kevin Wolf --- diff --git a/block/qcow2-snapshot.c b/block/qcow2-snapshot.c index 812dab2aa..fe7e14cc8 100644 --- a/block/qcow2-snapshot.c +++ b/block/qcow2-snapshot.c @@ -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; }