From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56909) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XDMZw-0006u1-Rc for qemu-devel@nongnu.org; Fri, 01 Aug 2014 19:49:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XDMZr-0000jW-Or for qemu-devel@nongnu.org; Fri, 01 Aug 2014 19:49:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:22410) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XDMZr-0000jB-HA for qemu-devel@nongnu.org; Fri, 01 Aug 2014 19:49:35 -0400 From: Max Reitz Date: Sat, 2 Aug 2014 01:49:17 +0200 Message-Id: <1406936961-20356-4-git-send-email-mreitz@redhat.com> In-Reply-To: <1406936961-20356-1-git-send-email-mreitz@redhat.com> References: <1406936961-20356-1-git-send-email-mreitz@redhat.com> Subject: [Qemu-devel] [PATCH v2 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 , =?UTF-8?q?Beno=C3=AEt=20Canet?= , 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 4b6406b..0bd8fa5 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -2808,7 +2808,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; -- 2.0.3