|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen stable-4.2] libxl: don't leak output vcpu info on error in libxl_list_vcpu
commit 05845ebd3c38ad36202ee7b129b7deef6b8552c0
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:41:05 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)
(cherry picked from commit d41c205e0173ee923e791c2fd320c7eb25f2e9cb)
---
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 4f28644..b9fb822 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -3909,15 +3909,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;
@@ -3927,6 +3927,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.2
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |