[PULL,16/17] hw/nios2:fix leak of fdevice tree blob
diff mbox series

Message ID 20200219101612.1033925-17-laurent@vivier.eu
State New
Headers show
Series
  • [PULL,01/17] mailmap: Add entry for Yu-Chen Lin
Related show

Commit Message

Laurent Vivier Feb. 19, 2020, 10:16 a.m. UTC
From: Chen Qun <kuhn.chenqun@huawei.com>

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>
---
 hw/nios2/boot.c | 1 +
 1 file changed, 1 insertion(+)

Patch
diff mbox series

diff --git a/hw/nios2/boot.c b/hw/nios2/boot.c
index 46b834987691..88224aa84c8b 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;
 }