coreboot/src/commonlib
Yu-Ping Wu 8a52418e9a commonlib/device_tree: Fix memory leak in fdt_unflatten()
When the passed `blob` is not a valid FDT, the memory allocated for
`tree` should be freed. Move the allocation after the fdt_is_valid()
check to avoid the problem.

Also remove the unnecessary cast to 'const struct fdt_header *'.

Change-Id: If591172cd511ae2a1ca9c26f2addef8d67fd0b69
Signed-off-by: Yu-Ping Wu <yupingso@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/88948
Reviewed-by: Nicholas Sudsgaard <devel+coreboot@nsudsgaard.com>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Rudolph <patrick.rudolph@9elements.com>
2025-08-29 09:10:27 +00:00
..
bsd treewide: Work around GCC 15 Werror=unterminated-string-initialization 2025-06-09 07:19:09 +00:00
include/commonlib commonlib/include/commonlib: Add volatile qualifier 2025-07-22 16:30:38 +00:00
storage commonlib/storage: Avoid build error when CONFIG_PCI is disabled 2025-04-03 03:11:05 +00:00
device_tree.c commonlib/device_tree: Fix memory leak in fdt_unflatten() 2025-08-29 09:10:27 +00:00
fsp_relocate.c commonlib/fsp_relocate: Add PE32+ support 2024-06-21 15:49:38 +00:00
iobuf.c src/commonlib: Clean up includes 2022-10-26 16:27:10 +00:00
list.c treewide: Move list.h to commonlib 2024-02-24 11:49:46 +00:00
Makefile.mk mb/emulation/qemu-riscv: Add support for 512 harts 2025-02-28 18:27:39 +00:00
mem_pool.c commonlib/mem_pool: Allow configuring the alignment 2021-11-04 10:33:52 +00:00
rational.c commonlib: Add support for rational number approximation 2022-08-03 03:26:13 +00:00
region.c region: Turn region_end() into an inclusive region_last() 2024-08-23 01:08:16 +00:00
sort.c treewide: Remove "this file is part of" lines 2020-05-11 17:11:40 +00:00