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

Re: [Xen-devel] [OPW PATCH 4/4] tools/xl:Call init and dispose function for libxl_dominfo



I was thinking to call _dispose at all the relevant exit sections of
main_list instead calling at the end so that I can avoid calling
_dispose twice on info_buf.
Will that work?

Regards,
Uma

On Tue, Oct 21, 2014 at 7:00 PM, Wei Liu <wei.liu2@xxxxxxxxxx> wrote:
> 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 <uma.sharma523@xxxxxxxxx>
>> > --
>> > 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;
>> >  }
>> >

_______________________________________________
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®.