Hi, In this version I fixed a mem leak that was happening if the user inputs a fdt via '-dtb'. In that case we would assign the updated FDT on top of the existing board FDT that was already assigned to ms->fdt.
Tested as follows: $ ./qemu-system-aarch64 -S -M virt -display none -qmp stdio {"QMP": {"version": {"qemu": {"micro": 91, "minor": 2, "major": 7}, "package": "v8.0.0-rc1-37-ge573ef31e7-dirty"}, "capabilities": ["oob"]}} {"execute": "qmp_capabilities", "arguments": {"enable": ["oob"]}} {"return": {}} {"execute": "dumpdtb", "arguments": {"filename": "fdt.dtb"}} {"return": {}} ^Cqemu-system-aarch64: terminating on signal 2 {"timestamp": {"seconds": 1679603324, "microseconds": 62159}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-signal"}} $ $ ./qemu-system-aarch64 -S -M virt -display none -qmp stdio -dtb fdt.dtb {"QMP": {"version": {"qemu": {"micro": 91, "minor": 2, "major": 7}, "package": "v8.0.0-rc1-37-ge573ef31e7-dirty"}, "capabilities": ["oob"]}} {"execute": "qmp_capabilities", "arguments": {"enable": ["oob"]}} {"return": {}} {"execute": "dumpdtb", "arguments": {"filename": "fdt.dtb"}} {"return": {}} ^Cqemu-system-aarch64: terminating on signal 2 {"timestamp": {"seconds": 1679603344, "microseconds": 145748}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-signal"}} $ First we use 'dumpdtb' to dump the board FDT in fdt.dtb, then we use it as an argument to '-dtb' and do the test again. This covers both code paths. Changes from v1: - g_free(ms->fdt) before load_device_tree() - v1 link: https://lists.gnu.org/archive/html/qemu-devel/2023-03/msg05930.html Cc: Peter Maydell <peter.mayd...@linaro.org> Cc: Markus Armbruster <arm...@redhat.com> Cc: qemu-...@nongnu.org Daniel Henrique Barboza (1): hw/arm: do not free machine->fdt in arm_load_dtb() hw/arm/boot.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) -- 2.39.2