From: Ian Campbell <ian.campbell@citrix.com>
To: Ian Jackson <Ian.Jackson@eu.citrix.com>,
Dario Faggioli <dario.faggioli@citrix.com>
Cc: xen-devel@lists.xenproject.org, wei.liu2@citrix.com,
Harmandeep Kaur <write.harmandeep@gmail.com>,
stefano.stabellini@eu.citrix.com
Subject: Re: [PATCH] libxc: Fix CID 1351228 resource leak
Date: Wed, 10 Feb 2016 14:09:34 +0000 [thread overview]
Message-ID: <1455113374.19857.158.camel@citrix.com> (raw)
In-Reply-To: <22203.7084.995481.990729@mariner.uk.xensource.com>
On Wed, 2016-02-10 at 11:14 +0000, Ian Jackson wrote:
> Dario Faggioli writes ("Re: [PATCH] libxc: Fix CID 1351228 resource
> leak"):
> > On Wed, 2016-02-10 at 14:39 +0530, Harmandeep Kaur wrote:
> > >
> > What I just said about the other patch ("libxc: Fix CID 1351225
> > resource leak") applies here as well, of course. :-)
> >
> > About the code...
> ...
> > > if ( t_info == NULL || t_info->tbuf_size == 0 )
> > > + {
> > > + xenforeignmemory_unmap(xch->fmem, t_info, 0);
> > > return -1;
> > > + }
> > >
> > > *size = t_info->tbuf_size;
> > > + xenforeignmemory_unmap(xch->fmem, t_info, *size);
> ...
> > I think you can arrange for only calling the unmapping function once,
> > i.e., put the unmap call in a place where (after a slight
> > reorganization of the rest of the code as well) it can be common to
> > both the success and error path.
>
> Indeed. See tools/libxl/CODING_STYLE.
The code being modified here is in libxc, so strictly speaking this doesn't
apply. However it is still a good principal to obey.
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
prev parent reply other threads:[~2016-02-10 14:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-10 9:09 [PATCH] libxc: Fix CID 1351228 resource leak Harmandeep Kaur
2016-02-10 9:32 ` Dario Faggioli
2016-02-10 11:14 ` Ian Jackson
2016-02-10 14:09 ` Ian Campbell [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1455113374.19857.158.camel@citrix.com \
--to=ian.campbell@citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=dario.faggioli@citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=wei.liu2@citrix.com \
--cc=write.harmandeep@gmail.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.