From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38022) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XihIV-0003o1-DK for qemu-devel@nongnu.org; Mon, 27 Oct 2014 06:13:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XihIQ-00063A-3c for qemu-devel@nongnu.org; Mon, 27 Oct 2014 06:13:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42565) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XihIP-000633-SG for qemu-devel@nongnu.org; Mon, 27 Oct 2014 06:13:06 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s9RAD5Ho007184 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 27 Oct 2014 06:13:05 -0400 From: Max Reitz Date: Mon, 27 Oct 2014 11:12:52 +0100 Message-Id: <1414404776-4919-4-git-send-email-mreitz@redhat.com> In-Reply-To: <1414404776-4919-1-git-send-email-mreitz@redhat.com> References: <1414404776-4919-1-git-send-email-mreitz@redhat.com> Subject: [Qemu-devel] [PATCH v4 3/7] qemu-img: Fix insignificant memleak List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Stefan Hajnoczi , Max Reitz As soon as options is set in img_amend(), it needs to be freed before the function returns. This leak is rather insignificant, as qemu-img will exit subsequently anyway, but there's no point in not fixing it. Signed-off-by: Max Reitz Reviewed-by: Eric Blake Reviewed-by: Benoit Canet --- qemu-img.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/qemu-img.c b/qemu-img.c index 9ec2c28..a60da8c 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -2847,7 +2847,9 @@ static int img_amend(int argc, char **argv) } if (optind != argc - 1) { - error_exit("Expecting one image file name"); + error_report("Expecting one image file name"); + ret = -1; + goto out; } flags = BDRV_O_FLAGS | BDRV_O_RDWR; -- 1.9.3