aboutsummaryrefslogtreecommitdiff
path: root/hw/nios2
diff options
context:
space:
mode:
authorChen Qun <kuhn.chenqun@huawei.com>2020-02-18 17:11:52 +0800
committerLaurent Vivier <laurent@vivier.eu>2020-02-19 10:32:50 +0100
commit757ca9b81a5d96db5194456ea66dc00bcf618323 (patch)
treebc88d7e1d8c912bfc17d7f6d6d59e453967d26dc /hw/nios2
parentb18ee6a217b88699d436c33543e5c64fff64da45 (diff)
hw/nios2: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 <euler.robot@huawei.com> Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20200218091154.21696-2-kuhn.chenqun@huawei.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'hw/nios2')
-rw-r--r--hw/nios2/boot.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/hw/nios2/boot.c b/hw/nios2/boot.c
index 46b8349876..88224aa84c 100644
--- a/hw/nios2/boot.c
+++ b/hw/nios2/boot.c
@@ -109,6 +109,7 @@ static int nios2_load_dtb(struct nios2_boot_info bi, const uint32_t ramsize,
}
cpu_physical_memory_write(bi.fdt, fdt, fdt_size);
+ g_free(fdt);
return fdt_size;
}