[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 17/30] hppa: fix leak from g_strdup_printf
From: |
Paolo Bonzini |
Subject: |
[PULL 17/30] hppa: fix leak from g_strdup_printf |
Date: |
Wed, 2 Oct 2019 18:51:40 +0200 |
memory_region_init_* takes care of copying the name into memory it owns.
Free it in the caller.
Signed-off-by: Paolo Bonzini <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
---
hw/hppa/dino.c | 1 +
hw/hppa/machine.c | 4 +++-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/hw/hppa/dino.c b/hw/hppa/dino.c
index e0466ee..ab6969b 100644
--- a/hw/hppa/dino.c
+++ b/hw/hppa/dino.c
@@ -485,6 +485,7 @@ PCIBus *dino_init(MemoryRegion *addr_space,
memory_region_init_alias(&s->pci_mem_alias[i], OBJECT(s),
name, &s->pci_mem, addr,
DINO_MEM_CHUNK_SIZE);
+ g_free(name);
}
/* Set up PCI view of memory: Bus master address space. */
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. */
--
1.8.3.1
- [PULL 09/30] target/i386/kvm: Silence warning from Valgrind about uninitialized bytes, (continued)
[PULL 13/30] hw/isa: Introduce a CONFIG_ISA_SUPERIO switch for isa-superio.c, Paolo Bonzini, 2019/10/02
[PULL 14/30] ide: fix leak from qemu_allocate_irqs, Paolo Bonzini, 2019/10/02
[PULL 16/30] mcf5208: fix leak from qemu_allocate_irqs, Paolo Bonzini, 2019/10/02
[PULL 15/30] microblaze: fix leak of fdevice tree blob, Paolo Bonzini, 2019/10/02
[PULL 17/30] hppa: fix leak from g_strdup_printf,
Paolo Bonzini <=
[PULL 18/30] mips: fix memory leaks in board initialization, Paolo Bonzini, 2019/10/02
[PULL 20/30] lm32: do not leak memory on object_new/object_unref, Paolo Bonzini, 2019/10/02
[PULL 21/30] docker: test-debug: disable LeakSanitizer, Paolo Bonzini, 2019/10/02
[PULL 19/30] cris: do not leak struct cris_disasm_data, Paolo Bonzini, 2019/10/02
[PULL 22/30] i386: Add CPUID bit for CLZERO and XSAVEERPTR, Paolo Bonzini, 2019/10/02
[PULL 23/30] vfio: Turn the container error into an Error handle, Paolo Bonzini, 2019/10/02
[PULL 25/30] Fix wrong behavior of cpu_memory_rw_debug() function in SMM, Paolo Bonzini, 2019/10/02
[PULL 26/30] util: WSAEWOULDBLOCK on connect should map to EINPROGRESS, Paolo Bonzini, 2019/10/02
[PULL 24/30] memory: allow memory_region_register_iommu_notifier() to fail, Paolo Bonzini, 2019/10/02