From: Chen Qun Date: Tue, 18 Feb 2020 09:11:53 +0000 (+0800) Subject: hw/ppc/virtex_ml507:fix leak of fdevice tree blob X-Git-Tag: v5.0.0-rc0~80^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=438bafcac55308eef4f9029c94dbadd2c7ac3bb7;p=thirdparty%2Fqemu.git hw/ppc/virtex_ml507: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 Message-Id: <20200218091154.21696-3-kuhn.chenqun@huawei.com> Signed-off-by: David Gibson --- diff --git a/hw/ppc/virtex_ml507.c b/hw/ppc/virtex_ml507.c index 91dd00ee91c..4eef70069f9 100644 --- a/hw/ppc/virtex_ml507.c +++ b/hw/ppc/virtex_ml507.c @@ -188,6 +188,7 @@ static int xilinx_load_device_tree(hwaddr addr, if (r < 0) fprintf(stderr, "couldn't set /chosen/bootargs\n"); cpu_physical_memory_write(addr, fdt, fdt_size); + g_free(fdt); return fdt_size; }