From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48241) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMqzc-0006lC-22 for qemu-devel@nongnu.org; Thu, 28 Aug 2014 00:07:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XMqzV-00078T-PT for qemu-devel@nongnu.org; Thu, 28 Aug 2014 00:07:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:21360) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMqzV-00078L-HA for qemu-devel@nongnu.org; Thu, 28 Aug 2014 00:07:17 -0400 Date: Thu, 28 Aug 2014 12:07:28 +0800 From: Fam Zheng Message-ID: <20140828040728.GF15156@T430.redhat.com> References: <1409119356-22742-1-git-send-email-famz@redhat.com> <1409119356-22742-2-git-send-email-famz@redhat.com> <20140827144652.GK31176@irqsave.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20140827144652.GK31176@irqsave.net> 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: =?iso-8859-1?Q?Beno=EEt?= Canet Cc: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi On Wed, 08/27 16:46, Beno=EEt Canet wrote: > 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, = QDict *options, int flags, > > qemu_opts_absorb_qdict(opts, options, &local_err); > > if (local_err) { > > error_propagate(errp, local_err); > > - return -EINVAL; > > + ret =3D -EINVAL; >=20 > 1) >=20 > Here you put the return code in ret and goto out. >=20 > > + 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; >=20 > 2) here you seem to want to do something later with the value of ret. >=20 > > } > > bs->total_sectors =3D ret; > > +out: > > + qemu_opts_del(opts); >=20 > > return 0; >=20 > Here the code simply return 0 discarding the return code you set in 1) = and 2). Good catch. Will fix. Fam >=20 > > } > > =20 > > --=20 > > 2.1.0 > >=20 > >=20