[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen stable-4.3] libxl: don't leak output vcpu info on error in libxl_list_vcpu
commit d41c205e0173ee923e791c2fd320c7eb25f2e9cb Author: Matthew Daley <mattd@xxxxxxxxxxx> AuthorDate: Sun Dec 1 23:15:01 2013 +1300 Commit: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx> CommitDate: Thu Jan 9 12:25:08 2014 +0000 libxl: don't leak output vcpu info on error in libxl_list_vcpu Coverity-ID: 1055887 Signed-off-by: Matthew Daley <mattd@xxxxxxxxxxx> Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> (cherry picked from commit 3c113a57f55dc4e36e3552342721db01efa832c6) --- tools/libxl/libxl.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 00430fb..3d9543b 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -4180,15 +4180,15 @@ libxl_vcpuinfo *libxl_list_vcpu(libxl_ctx *ctx, uint32_t domid, for (*nb_vcpu = 0; *nb_vcpu <= domaininfo.max_vcpu_id; ++*nb_vcpu, ++ptr) { if (libxl_cpu_bitmap_alloc(ctx, &ptr->cpumap, 0)) { LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "allocating cpumap"); - return NULL; + goto err; } if (xc_vcpu_getinfo(ctx->xch, domid, *nb_vcpu, &vcpuinfo) == -1) { LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting vcpu info"); - return NULL; + goto err; } if (xc_vcpu_getaffinity(ctx->xch, domid, *nb_vcpu, ptr->cpumap.map) == -1) { LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting vcpu affinity"); - return NULL; + goto err; } ptr->vcpuid = *nb_vcpu; ptr->cpu = vcpuinfo.cpu; @@ -4198,6 +4198,10 @@ libxl_vcpuinfo *libxl_list_vcpu(libxl_ctx *ctx, uint32_t domid, ptr->vcpu_time = vcpuinfo.cpu_time; } return ret; + +err: + free(ret); + return NULL; } int libxl_set_vcpuaffinity(libxl_ctx *ctx, uint32_t domid, uint32_t vcpuid, -- generated by git-patchbot for /home/xen/git/xen.git#stable-4.3 _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |