From: aliguori Date: Thu, 8 Jan 2009 19:32:20 +0000 (+0000) Subject: qcow2: free old snapshots array upon creation of a new one (Uri Lublin) X-Git-Tag: stefano.display-merge-end~196 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=54c16572a03e3c9c5694653361f9bfa3959fcb59;p=qemu-xen-3.4-testing.git qcow2: free old snapshots array upon creation of a new one (Uri Lublin) Don't leak memory Rebased for qemu tree. Signed-off-by: Uri Lublin Signed-off-by: Anthony Liguori git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6245 c046a42c-6fe2-441c-8c8c-71466251a162 --- diff --git a/block-qcow2.c b/block-qcow2.c index 707109e4..9aa7261e 100644 --- a/block-qcow2.c +++ b/block-qcow2.c @@ -2024,6 +2024,7 @@ static int qcow_snapshot_create(BlockDriverState *bs, if (!snapshots1) goto fail; memcpy(snapshots1, s->snapshots, s->nb_snapshots * sizeof(QCowSnapshot)); + qemu_free(s->snapshots); s->snapshots = snapshots1; s->snapshots[s->nb_snapshots++] = *sn;