diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2019-10-01 15:36:24 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2019-10-04 18:49:17 +0200 |
commit | 266a880e31d58539a1c7f0177690a047f5016505 (patch) | |
tree | 3d14a74ab6a857f507aad83184094a9771cfa85e /hw/hppa/machine.c | |
parent | 67c1ea9940afd73ebc66987672617b6694ba1e4a (diff) | |
download | qemu-266a880e31d58539a1c7f0177690a047f5016505.zip qemu-266a880e31d58539a1c7f0177690a047f5016505.tar.gz qemu-266a880e31d58539a1c7f0177690a047f5016505.tar.bz2 |
hppa: fix leak from g_strdup_printf
memory_region_init_* takes care of copying the name into memory it owns.
Free it in the caller.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Diffstat (limited to 'hw/hppa/machine.c')
-rw-r--r-- | hw/hppa/machine.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c index 2736ce8..7e23675 100644 --- a/hw/hppa/machine.c +++ b/hw/hppa/machine.c @@ -78,13 +78,15 @@ static void machine_hppa_init(MachineState *machine) /* Create CPUs. */ for (i = 0; i < smp_cpus; i++) { + char *name = g_strdup_printf("cpu%ld-io-eir", i); cpu[i] = HPPA_CPU(cpu_create(machine->cpu_type)); cpu_region = g_new(MemoryRegion, 1); memory_region_init_io(cpu_region, OBJECT(cpu[i]), &hppa_io_eir_ops, - cpu[i], g_strdup_printf("cpu%ld-io-eir", i), 4); + cpu[i], name, 4); memory_region_add_subregion(addr_space, CPU_HPA + i * 0x1000, cpu_region); + g_free(name); } /* Limit main memory. */ |