diff options
Diffstat (limited to 'tools/libxc/xc_core.c')
-rw-r--r-- | tools/libxc/xc_core.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tools/libxc/xc_core.c b/tools/libxc/xc_core.c index ef1e8dd7a1..8121a08bf0 100644 --- a/tools/libxc/xc_core.c +++ b/tools/libxc/xc_core.c @@ -430,7 +430,7 @@ xc_domain_dumpcore_via_callback(int xc_handle, int nr_vcpus = 0; char *dump_mem, *dump_mem_start = NULL; - vcpu_guest_context_any_t ctxt[MAX_VIRT_CPUS]; + vcpu_guest_context_any_t *ctxt = NULL; struct xc_core_arch_context arch_ctxt; char dummy[PAGE_SIZE]; int dummy_len; @@ -495,6 +495,13 @@ xc_domain_dumpcore_via_callback(int xc_handle, goto out; } + ctxt = calloc(sizeof(*ctxt), info.max_vcpu_id + 1); + if ( !ctxt ) + { + PERROR("Could not allocate vcpu context array", domid); + goto out; + } + for ( i = 0; i <= info.max_vcpu_id; i++ ) { if ( xc_vcpu_getcontext(xc_handle, domid, i, &ctxt[nr_vcpus]) == 0 ) @@ -900,6 +907,8 @@ out: xc_core_shdr_free(sheaders); if ( strtab != NULL ) xc_core_strtab_free(strtab); + if ( ctxt != NULL ) + free(ctxt); if ( dump_mem_start != NULL ) free(dump_mem_start); if ( live_shinfo != NULL ) |