[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 17/20] ppc: free 'fdt' after reset the machine
From: |
David Gibson |
Subject: |
[PULL 17/20] ppc: free 'fdt' after reset the machine |
Date: |
Fri, 21 Feb 2020 14:36:47 +1100 |
From: Pan Nengyuan <address@hidden>
'fdt' forgot to clean both e500 and pnv when we call 'system_reset' on ppc,
this patch fix it. The leak stacks are as follow:
Direct leak of 4194304 byte(s) in 4 object(s) allocated from:
#0 0x7fafe37dd970 in __interceptor_calloc (/lib64/libasan.so.5+0xef970)
#1 0x7fafe2e3149d in g_malloc0 (/lib64/libglib-2.0.so.0+0x5249d)
#2 0x561876f7f80d in create_device_tree
/mnt/sdb/qemu-new/qemu/device_tree.c:40
#3 0x561876b7ac29 in ppce500_load_device_tree
/mnt/sdb/qemu-new/qemu/hw/ppc/e500.c:364
#4 0x561876b7f437 in ppce500_reset_device_tree
/mnt/sdb/qemu-new/qemu/hw/ppc/e500.c:617
#5 0x56187718b1ae in qemu_devices_reset
/mnt/sdb/qemu-new/qemu/hw/core/reset.c:69
#6 0x561876f6938d in qemu_system_reset /mnt/sdb/qemu-new/qemu/vl.c:1412
#7 0x561876f6a25b in main_loop_should_exit /mnt/sdb/qemu-new/qemu/vl.c:1645
#8 0x561876f6a398 in main_loop /mnt/sdb/qemu-new/qemu/vl.c:1679
#9 0x561876f7da8e in main /mnt/sdb/qemu-new/qemu/vl.c:4438
#10 0x7fafde16b812 in __libc_start_main ../csu/libc-start.c:308
#11 0x5618765c055d in _start
(/mnt/sdb/qemu-new/qemu/build/ppc64-softmmu/qemu-system-ppc64+0x2b1555d)
Direct leak of 1048576 byte(s) in 1 object(s) allocated from:
#0 0x7fc0a6f1b970 in __interceptor_calloc (/lib64/libasan.so.5+0xef970)
#1 0x7fc0a656f49d in g_malloc0 (/lib64/libglib-2.0.so.0+0x5249d)
#2 0x55eb05acd2ca in pnv_dt_create /mnt/sdb/qemu-new/qemu/hw/ppc/pnv.c:507
#3 0x55eb05ace5bf in pnv_reset /mnt/sdb/qemu-new/qemu/hw/ppc/pnv.c:578
#4 0x55eb05f2f395 in qemu_system_reset /mnt/sdb/qemu-new/qemu/vl.c:1410
#5 0x55eb05f43850 in main /mnt/sdb/qemu-new/qemu/vl.c:4403
#6 0x7fc0a18a9812 in __libc_start_main ../csu/libc-start.c:308
#7 0x55eb0558655d in _start
(/mnt/sdb/qemu-new/qemu/build/ppc64-softmmu/qemu-system-ppc64+0x2b1555d)
Reported-by: Euler Robot <address@hidden>
Signed-off-by: Pan Nengyuan <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Greg Kurz <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
hw/ppc/e500.c | 1 +
hw/ppc/pnv.c | 2 ++
2 files changed, 3 insertions(+)
diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
index 886442e54f..af537bba2b 100644
--- a/hw/ppc/e500.c
+++ b/hw/ppc/e500.c
@@ -594,6 +594,7 @@ done:
cpu_physical_memory_write(addr, fdt, fdt_size);
}
ret = fdt_size;
+ g_free(fdt);
out:
g_free(pci_map);
diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index 139c857b1e..e98038b809 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -582,6 +582,8 @@ static void pnv_reset(MachineState *machine)
qemu_fdt_dumpdtb(fdt, fdt_totalsize(fdt));
cpu_physical_memory_write(PNV_FDT_ADDR, fdt, fdt_totalsize(fdt));
+
+ g_free(fdt);
}
static ISABus *pnv_chip_power8_isa_create(PnvChip *chip, Error **errp)
--
2.24.1
- [PULL 05/20] mem: move nvdimm_device_list to utilities, (continued)
- [PULL 05/20] mem: move nvdimm_device_list to utilities, David Gibson, 2020/02/20
- [PULL 08/20] spapr: Add Hcalls to support PAPR NVDIMM device, David Gibson, 2020/02/20
- [PULL 06/20] nvdimm: add uuid property to nvdimm, David Gibson, 2020/02/20
- [PULL 09/20] target/ppc/cpu.h: Remove duplicate includes, David Gibson, 2020/02/20
- [PULL 07/20] spapr: Add NVDIMM device support, David Gibson, 2020/02/20
- [PULL 12/20] pnv/phb3: Add missing break statement, David Gibson, 2020/02/20
- [PULL 10/20] pnv/phb3: Convert 1u to 1ull, David Gibson, 2020/02/20
- [PULL 16/20] target/ppc/cpu.h: Clean up comments in the struct CPUPPCState definition, David Gibson, 2020/02/20
- [PULL 17/20] ppc: free 'fdt' after reset the machine,
David Gibson <=
- [PULL 13/20] spapr: Allow changing offset for -kernel image, David Gibson, 2020/02/20
- [PULL 18/20] spapr: Don't use spapr_drc_needed() in CAS code, David Gibson, 2020/02/20
- [PULL 11/20] pnv/phb4: Fix error path in pnv_pec_realize(), David Gibson, 2020/02/20
- [PULL 14/20] target/ppc: Fix typo in comments, David Gibson, 2020/02/20
- [PULL 15/20] target/ppc/cpu.h: Move fpu related members closer in cpu env, David Gibson, 2020/02/20
- [PULL 20/20] hw/ppc/virtex_ml507:fix leak of fdevice tree blob, David Gibson, 2020/02/20
- [PULL 19/20] spapr: Fix handling of unplugged devices during CAS and migration, David Gibson, 2020/02/20
- Re: [PULL 00/20] ppc-for-5.0 queue 20200221, Peter Maydell, 2020/02/21