From: Wei Liu Subject: Re: [OPW PATCH 4/4] tools/xl:Call init and dispose function for libxl_dominfo Date: Tue, 21 Oct 2014 14:30:43 +0100 Message-ID: <20141021133043.GE10234@zion.uk.xensource.com> References: <544583e4.c8e7420a.6486.ffffb2da@mx.google.com> <20141021125957.GB10234@zion.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <20141021125957.GB10234@zion.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Uma Sharma Cc: George.Dunlap@eu.citrix.com, Ian.Jackson@citrix.com, Wei.Liu2@citrix.com, Ian.Campbell@citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Tue, Oct 21, 2014 at 01:59:57PM +0100, Wei Liu wrote: > On Tue, Oct 21, 2014 at 03:21:21AM +0530, Uma Sharma wrote: > > This patch calls init and dispose function for libxl_dominfo type in function main_list in > > tools/libxl/xl_cmdimpl.c > > IDL generated libxl types should be used only after calling the init > > function. > > > > Signed-off-by: Uma Sharma > > -- > > diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c > > index 2e923b4..133e796 100644 > > --- a/tools/libxl/xl_cmdimpl.c > > +++ b/tools/libxl/xl_cmdimpl.c > > @@ -4330,6 +4330,7 @@ int main_list(int argc, char **argv) > > libxl_dominfo *info, *info_free=0; > > int nb_domain, rc; > > > > + libxl_dominfo_init(&info_buf); > > SWITCH_FOREACH_OPT(opt, "lvhZn", opts, "list", 0) { > > case 'l': > > details = 1; > > @@ -4381,6 +4382,7 @@ int main_list(int argc, char **argv) > > else > > libxl_dominfo_dispose(info); > > > > + libxl_dominfo_dispose(&info_buf); > > I'm sorry that main_list is a bit entangled. But I don't think the > patch proposed here is right. There's one branch that makes info point > to &info_buf. > > Though we intend to make _dispose idempotent, but it's not idempotent for > libxl_dominfo_dispose. Calling it on the same object twice yields no > good result. > > Wei. > BTW I think main_sharing suffers from the same problem. If you figure out a way to improve main_list, you can take main_sharing as extra bonus. :-) Wei. > > return 0; > > } > >