From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58180) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VTt5d-0008KK-9J for qemu-devel@nongnu.org; Wed, 09 Oct 2013 08:42:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VTt5W-0008QS-V5 for qemu-devel@nongnu.org; Wed, 09 Oct 2013 08:42:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:13789) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VTt5W-0008QC-No for qemu-devel@nongnu.org; Wed, 09 Oct 2013 08:42:02 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r99Cg2rb005962 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 9 Oct 2013 08:42:02 -0400 From: Max Reitz Date: Wed, 9 Oct 2013 14:42:00 +0200 Message-Id: <1381322520-18656-1-git-send-email-mreitz@redhat.com> Subject: [Qemu-devel] [PATCH] qcow2: Fix snapshot restoration in snapshot_create List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Stefan Hajnoczi , Max Reitz 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 --- block/qcow2-snapshot.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/qcow2-snapshot.c b/block/qcow2-snapshot.c index 812dab2..fe7e14c 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; } -- 1.8.3.1