From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:35684) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TQxcL-0001Bh-5j for qemu-devel@nongnu.org; Wed, 24 Oct 2012 05:51:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TQxcH-0006kT-2T for qemu-devel@nongnu.org; Wed, 24 Oct 2012 05:51:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35493) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TQxcG-0006kC-Oj for qemu-devel@nongnu.org; Wed, 24 Oct 2012 05:51:12 -0400 From: Kevin Wolf Date: Wed, 24 Oct 2012 11:50:35 +0200 Message-Id: <1351072256-6112-12-git-send-email-kwolf@redhat.com> In-Reply-To: <1351072256-6112-1-git-send-email-kwolf@redhat.com> References: <1351072256-6112-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH 11/32] block: bdrv_create(): don't leak cco.filename on error List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws Cc: kwolf@redhat.com, qemu-devel@nongnu.org From: Luiz Capitulino Signed-off-by: Luiz Capitulino Reviewed-by: Stefan Hajnoczi Signed-off-by: Kevin Wolf --- block.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/block.c b/block.c index 5e7fc9e..7e26b6f 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; } -- 1.7.6.5