[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 2/2] tools/libxl/libxl_qmp.c: Close fds on error path in qmp_open



On Wed, 2015-03-18 at 10:15 +0000, Wei Liu wrote:
> On Wed, Mar 18, 2015 at 06:50:35AM +0000, PRAMOD DEVENDRA wrote:
> > From: Pramod Devendra <pramod.devendra@xxxxxxxxxx>
> > 
> > Signed-off-by: Pramod Devendra <pramod.devendra@xxxxxxxxxx>
> > CC: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
> > CC: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
> > CC: Ian Campbell <ian.campbell@xxxxxxxxxx>
> > CC: Wei Liu <wei.liu2@xxxxxxxxxx>
> 
> Thanks.
> 
> The patch content looks good.

Actually I think it should use the goto out error handling style, rather
than closing the fd on every single path.

i.e. the tail should be:

 out:
  if (ret == -1 && qmp->qmp_fd > -1) close(qmp->qmp_fd);

  return ret;

and ret should be initialised to -1 at the top, and each return should
be a goto.



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.