summaryrefslogtreecommitdiff
path: root/hw/i386/xen/xen-hvm.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/i386/xen/xen-hvm.c')
-rw-r--r--hw/i386/xen/xen-hvm.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c
index cf8e500514..0731f70410 100644
--- a/hw/i386/xen/xen-hvm.c
+++ b/hw/i386/xen/xen-hvm.c
@@ -396,7 +396,7 @@ go_physmap:
mr_name = memory_region_name(mr);
- physmap = g_malloc(sizeof(XenPhysmap));
+ physmap = g_new(XenPhysmap, 1);
physmap->start_addr = start_addr;
physmap->size = size;
@@ -1281,7 +1281,7 @@ static void xen_read_physmap(XenIOState *state)
return;
for (i = 0; i < num; i++) {
- physmap = g_malloc(sizeof (XenPhysmap));
+ physmap = g_new(XenPhysmap, 1);
physmap->phys_offset = strtoull(entries[i], NULL, 16);
snprintf(path, sizeof(path),
"/local/domain/0/device-model/%d/physmap/%s/start_addr",
@@ -1410,7 +1410,7 @@ void xen_hvm_init_pc(PCMachineState *pcms, MemoryRegion **ram_memory)
xen_pfn_t ioreq_pfn;
XenIOState *state;
- state = g_malloc0(sizeof (XenIOState));
+ state = g_new0(XenIOState, 1);
state->xce_handle = xenevtchn_open(NULL, 0);
if (state->xce_handle == NULL) {
@@ -1463,7 +1463,7 @@ void xen_hvm_init_pc(PCMachineState *pcms, MemoryRegion **ram_memory)
}
/* Note: cpus is empty at this point in init */
- state->cpu_by_vcpu_id = g_malloc0(max_cpus * sizeof(CPUState *));
+ state->cpu_by_vcpu_id = g_new0(CPUState *, max_cpus);
rc = xen_set_ioreq_server_state(xen_domid, state->ioservid, true);
if (rc < 0) {
@@ -1472,7 +1472,7 @@ void xen_hvm_init_pc(PCMachineState *pcms, MemoryRegion **ram_memory)
goto err;
}
- state->ioreq_local_port = g_malloc0(max_cpus * sizeof (evtchn_port_t));
+ state->ioreq_local_port = g_new0(evtchn_port_t, max_cpus);
/* FIXME: how about if we overflow the page here? */
for (i = 0; i < max_cpus; i++) {