From d1cb67841ca213802ee789957188ec87e8b7996d Mon Sep 17 00:00:00 2001 From: Chen Qun Date: Tue, 18 Feb 2020 17:11:54 +0800 Subject: [PATCH] hw/xtensa/xtfpga:fix leak of fdevice tree blob The device tree blob returned by load_device_tree is malloced. We should free it after cpu_physical_memory_write(). Reported-by: Euler Robot Signed-off-by: Chen Qun Acked-by: Max Filippov Reviewed-by: Laurent Vivier Message-Id: <20200218091154.21696-4-kuhn.chenqun@huawei.com> Signed-off-by: Laurent Vivier --- hw/xtensa/xtfpga.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/xtensa/xtfpga.c b/hw/xtensa/xtfpga.c index 8e2dd1327a..60ccc74f5f 100644 --- a/hw/xtensa/xtfpga.c +++ b/hw/xtensa/xtfpga.c @@ -380,6 +380,7 @@ static void xtfpga_init(const XtfpgaBoardDesc *board, MachineState *machine) cur_tagptr = put_tag(cur_tagptr, BP_TAG_FDT, sizeof(dtb_addr), &dtb_addr); cur_lowmem = QEMU_ALIGN_UP(cur_lowmem + fdt_size, 4 * KiB); + g_free(fdt); } #else if (dtb_filename) {