[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 5/9] libxl: avoid leaking string in cpupool_info
On Mon, Jul 13, 2015 at 05:23:10PM +0100, Ian Campbell wrote: > On Mon, 2015-07-13 at 17:10 +0100, Wei Liu wrote: > > On Mon, Jul 13, 2015 at 11:07:31AM +0100, Ian Campbell wrote: > > > On Fri, 2015-07-10 at 19:00 +0100, Wei Liu wrote: > > > > Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> > > > > > > Would an "if (rc) libxl_cpupoolinfo_dispose(info)" on the exit path be a > > > more robust alternative? Might require the addition of a > > > libxl_cpupoolinfo_init() somewhere before any possible error. > > > > > > > Yes, you're right, it would be better to fix the caller. > > I was suggesting to do it in this function, not the caller. > No, that's not right, that violates libxl calling style. The caller is supposed to call _init function before coming to this function. Wei. > > > > > This results in a larger patch than this one. I will send out the new > > version soon. > > > > Wei. > > > > > > --- > > > > tools/libxl/libxl.c | 4 +++- > > > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > > > > > diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c > > > > index 38aff8d..4151dcb 100644 > > > > --- a/tools/libxl/libxl.c > > > > +++ b/tools/libxl/libxl.c > > > > @@ -740,8 +740,10 @@ static int cpupool_info(libxl__gc *gc, > > > > info->sched = xcinfo->sched_id; > > > > info->n_dom = xcinfo->n_dom; > > > > rc = libxl_cpu_bitmap_alloc(CTX, &info->cpumap, 0); > > > > - if (rc) > > > > + if (rc) { > > > > + free(info->pool_name); > > > > goto out; > > > > + } > > > > > > > > memcpy(info->cpumap.map, xcinfo->cpumap, info->cpumap.size); > > > > > > > > _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |