From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LKzJn-0005mc-6A for qemu-devel@nongnu.org; Thu, 08 Jan 2009 13:09:19 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LKzJl-0005mA-Vr for qemu-devel@nongnu.org; Thu, 08 Jan 2009 13:09:18 -0500 Received: from [199.232.76.173] (port=40270 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LKzJl-0005m7-Rb for qemu-devel@nongnu.org; Thu, 08 Jan 2009 13:09:17 -0500 Received: from mx2.redhat.com ([66.187.237.31]:55465) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LKzJk-0003Ad-UV for qemu-devel@nongnu.org; Thu, 08 Jan 2009 13:09:17 -0500 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n08I9FNP001323 for ; Thu, 8 Jan 2009 13:09:15 -0500 Message-ID: <49664148.9040405@redhat.com> Date: Thu, 08 Jan 2009 20:09:12 +0200 From: Uri Lublin MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH v2] qcow2: free old snapshots array upon creation of a new one Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Uri Lublin From: Uri Lublin Don't leak memory Rebased for qemu tree. Signed-off-by: Uri Lublin --- block-qcow2.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/block-qcow2.c b/block-qcow2.c index 707109e..9aa7261 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; -- 1.6.0.6