From patchwork Thu Mar 4 09:00:36 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 46902 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C642EB7CEC for ; Thu, 4 Mar 2010 20:43:27 +1100 (EST) Received: from localhost ([127.0.0.1]:56889 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nn7Kd-000081-20 for incoming@patchwork.ozlabs.org; Thu, 04 Mar 2010 04:26:59 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nn6vV-0003tP-UD for qemu-devel@nongnu.org; Thu, 04 Mar 2010 04:01:02 -0500 Received: from [199.232.76.173] (port=45415 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nn6vT-0003sx-VK for qemu-devel@nongnu.org; Thu, 04 Mar 2010 04:01:00 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Nn6vS-0004Tx-M3 for qemu-devel@nongnu.org; Thu, 04 Mar 2010 04:00:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:21577) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Nn6vR-0004Tj-TW for qemu-devel@nongnu.org; Thu, 04 Mar 2010 04:00:58 -0500 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o2490unn017901 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 4 Mar 2010 04:00:56 -0500 Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o2490eta010016; Thu, 4 Mar 2010 04:00:54 -0500 From: Juan Quintela To: qemu-devel@nongnu.org Date: Thu, 4 Mar 2010 10:00:36 +0100 Message-Id: <315b904b5627115bda0e92dde097be4673298c5e.1267692963.git.quintela@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.17 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [Qemu-devel] [PATCH 07/10] vmdk: fix double free X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org fail_gd error case would also free rgd_buf that was already freed Signed-off-by: Juan Quintela --- block/vmdk.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/block/vmdk.c b/block/vmdk.c index 67a690e..819c1c9 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -315,7 +315,6 @@ static int vmdk_snapshot_create(const char *filename, const char *backing_file) ret = -errno; goto fail_rgd; } - qemu_free(rgd_buf); /* write GD */ gd_buf = qemu_malloc(gd_size); @@ -336,6 +335,7 @@ static int vmdk_snapshot_create(const char *filename, const char *backing_file) goto fail_gd; } qemu_free(gd_buf); + qemu_free(rgd_buf); close(p_fd); close(snp_fd);