[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] libxl: correct libxl to obey libxl's programming paramdigm
On Wed, Jul 30, 2014 at 12:18:55PM -0400, Meng Xu wrote: > When sched_domain_get() return rc != 0, scinfo will not be disposed. > This violates the libxl programming paradigm: > 272 * The user must always calls "dispose" exactly > 273 * once afterwards, to clean up, regardless of whether operations > on > 274 * this object succeeded or failed. > I would remove the line number because the header file changes as much sutffs added in. > Signed-off-by: Meng Xu <mengxu@xxxxxxxxxxxxx> > --- > tools/libxl/xl_cmdimpl.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c > index 01bce2f..d1efdd7 100644 > --- a/tools/libxl/xl_cmdimpl.c > +++ b/tools/libxl/xl_cmdimpl.c > @@ -5014,7 +5014,7 @@ static int sched_credit_domain_output(int domid) > } > rc = sched_domain_get(LIBXL_SCHEDULER_CREDIT, domid, &scinfo); > if (rc) > - return rc; > + goto out; > domname = libxl_domid_to_name(ctx, domid); > printf("%-33s %4d %6d %4d\n", > domname, > @@ -5022,6 +5022,7 @@ static int sched_credit_domain_output(int domid) > scinfo.weight, > scinfo.cap); > free(domname); > +out: > libxl_domain_sched_params_dispose(&scinfo); And you seem to miss this part of that paradigm: * IDL-generated libxl types should be used as follows: the user must * always call the "init" function before using a type, even if the * variable is simply being passed by reference as an out parameter * to a libxl function. So calling dispose in the end while not calling init at the beginning is still bogus. Wei. _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |