From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54953) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMeVo-0003fW-O9 for qemu-devel@nongnu.org; Wed, 27 Aug 2014 10:47:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XMeVi-00068b-J6 for qemu-devel@nongnu.org; Wed, 27 Aug 2014 10:47:48 -0400 Received: from lputeaux-656-01-25-125.w80-12.abo.wanadoo.fr ([80.12.84.125]:39660 helo=paradis.irqsave.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMeVi-00068X-CF for qemu-devel@nongnu.org; Wed, 27 Aug 2014 10:47:42 -0400 Date: Wed, 27 Aug 2014 16:46:53 +0200 From: =?iso-8859-1?Q?Beno=EEt?= Canet Message-ID: <20140827144652.GK31176@irqsave.net> References: <1409119356-22742-1-git-send-email-famz@redhat.com> <1409119356-22742-2-git-send-email-famz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1409119356-22742-2-git-send-email-famz@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 1/4] nfs: Fix leak of opts in nfs_file_open List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi The Wednesday 27 Aug 2014 =E0 14:02:33 (+0800), Fam Zheng wrote : > Signed-off-by: Fam Zheng > --- > block/nfs.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) >=20 > diff --git a/block/nfs.c b/block/nfs.c > index 93d87f3..36e8057 100644 > --- a/block/nfs.c > +++ b/block/nfs.c > @@ -393,15 +393,18 @@ static int nfs_file_open(BlockDriverState *bs, QD= ict *options, int flags, > qemu_opts_absorb_qdict(opts, options, &local_err); > if (local_err) { > error_propagate(errp, local_err); > - return -EINVAL; > + ret =3D -EINVAL; 1) Here you put the return code in ret and goto out. > + goto out; > } > ret =3D nfs_client_open(client, qemu_opt_get(opts, "filename"), > (flags & BDRV_O_RDWR) ? O_RDWR : O_RDONLY, > errp); > if (ret < 0) { > - return ret; > + goto out; 2) here you seem to want to do something later with the value of ret. > } > bs->total_sectors =3D ret; > +out: > + qemu_opts_del(opts); > return 0; Here the code simply return 0 discarding the return code you set in 1) an= d 2). > } > =20 > --=20 > 2.1.0 >=20 >=20