hw/ppc/virtex_ml507:fix leak of fdevice tree blob
authorChen Qun <kuhn.chenqun@huawei.com>
Tue, 18 Feb 2020 09:11:53 +0000 (17:11 +0800)
committerDavid Gibson <david@gibson.dropbear.id.au>
Thu, 20 Feb 2020 22:15:04 +0000 (09:15 +1100)
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>
Message-Id: <20200218091154.21696-3-kuhn.chenqun@huawei.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
hw/ppc/virtex_ml507.c

index 91dd00ee91c82642abc3cf49ead819be7f49af59..4eef70069f97f52617c3b955c1c338bec78734e1 100644 (file)
@@ -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;
 }