From patchwork Wed Oct 17 19:45:25 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 192129 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id AF0762C0091 for ; Thu, 18 Oct 2012 06:44:41 +1100 (EST) Received: from localhost ([::1]:52072 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOZXj-0008UQ-TI for incoming@patchwork.ozlabs.org; Wed, 17 Oct 2012 15:44:39 -0400 Received: from eggs.gnu.org ([208.118.235.92]:45906) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOZXb-0008U2-Cc for qemu-devel@nongnu.org; Wed, 17 Oct 2012 15:44:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TOZXa-00046e-CU for qemu-devel@nongnu.org; Wed, 17 Oct 2012 15:44:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58328) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOZXa-00046X-2w; Wed, 17 Oct 2012 15:44:30 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q9HJiTtE024334 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 17 Oct 2012 15:44:29 -0400 Received: from doriath.home (ovpn-113-93.phx2.redhat.com [10.3.113.93]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q9HJiRU7006813; Wed, 17 Oct 2012 15:44:28 -0400 Date: Wed, 17 Oct 2012 16:45:25 -0300 From: Luiz Capitulino To: qemu-devel Message-ID: <20121017164525.0e9b2941@doriath.home> Organization: Red Hat Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: qemu-trivial@nongnu.org, Kevin Wolf Subject: [Qemu-devel] [PATCH] block: bdrv_create(): don't leak cco.filename on error X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Luiz Capitulino Reviewed-by: Stefan Hajnoczi --- block.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/block.c b/block.c index 5e8184f..63bf768 100644 --- a/block.c +++ b/block.c @@ -379,7 +379,8 @@ int bdrv_create(BlockDriver *drv, const char* filename, }; if (!drv->bdrv_create) { - return -ENOTSUP; + ret = -ENOTSUP; + goto out; } if (qemu_in_coroutine()) { @@ -394,8 +395,9 @@ int bdrv_create(BlockDriver *drv, const char* filename, } ret = cco.ret; - g_free(cco.filename); +out: + g_free(cco.filename); return ret; }