]> git.proxmox.com Git - mirror_qemu.git/commitdiff
hw/xtensa/xtfpga:fix leak of fdevice tree blob
authorChen Qun <kuhn.chenqun@huawei.com>
Tue, 18 Feb 2020 09:11:54 +0000 (17:11 +0800)
committerLaurent Vivier <laurent@vivier.eu>
Wed, 19 Feb 2020 09:33:38 +0000 (10:33 +0100)
The device tree blob returned by load_device_tree is malloced.
We should free it after cpu_physical_memory_write().

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
Acked-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20200218091154.21696-4-kuhn.chenqun@huawei.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
hw/xtensa/xtfpga.c

index 8e2dd1327a462ca056905ca1ad91cb8308894685..60ccc74f5f1d693f5823a784a18349975ffbe29d 100644 (file)
@@ -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) {