From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38009) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlGBf-000650-Qw for qemu-devel@nongnu.org; Mon, 03 Nov 2014 06:52:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XlGBb-0000oa-93 for qemu-devel@nongnu.org; Mon, 03 Nov 2014 06:52:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44639) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlGBb-0000n7-27 for qemu-devel@nongnu.org; Mon, 03 Nov 2014 06:52:39 -0500 From: Stefan Hajnoczi Date: Mon, 3 Nov 2014 11:50:41 +0000 Message-Id: <1415015456-25086-39-git-send-email-stefanha@redhat.com> In-Reply-To: <1415015456-25086-1-git-send-email-stefanha@redhat.com> References: <1415015456-25086-1-git-send-email-stefanha@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 38/53] qemu-img: Fix insignificant memleak List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Stefan Hajnoczi , Max Reitz From: 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 Reviewed-by: Kevin Wolf Reviewed-by: Beno=C3=AEt Canet Message-id: 1414404776-4919-4-git-send-email-mreitz@redhat.com Signed-off-by: Stefan Hajnoczi --- qemu-img.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/qemu-img.c b/qemu-img.c index c7b394a..66a7eb4 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -2948,7 +2948,9 @@ static int img_amend(int argc, char **argv) } =20 if (optind !=3D argc - 1) { - error_exit("Expecting one image file name"); + error_report("Expecting one image file name"); + ret =3D -1; + goto out; } =20 flags =3D BDRV_O_FLAGS | BDRV_O_RDWR; --=20 1.9.3