mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2026-01-27 12:47:24 +01:00
[ Upstream commit 235a1eb8d2dcc49a6cf0a5ee1aa85544a5d0054b ]
In unittest_data_add(), if of_resolve_phandles() fails, the allocated
unittest_data is not freed, leading to a memory leak.
Fix this by using scope-based cleanup helper __free(kfree) for automatic
resource cleanup. This ensures unittest_data is automatically freed when
it goes out of scope in error paths.
For the success path, use retain_and_null_ptr() to transfer ownership
of the memory to the device tree and prevent double freeing.
Fixes:
|
||
|---|---|---|
| .. | ||
| unittest-data | ||
| .kunitconfig | ||
| address.c | ||
| base.c | ||
| cpu.c | ||
| device.c | ||
| dynamic.c | ||
| empty_root.dts | ||
| fdt_address.c | ||
| fdt.c | ||
| irq.c | ||
| Kconfig | ||
| kexec.c | ||
| kobj.c | ||
| kunit_overlay_test.dtso | ||
| Makefile | ||
| module.c | ||
| of_kunit_helpers.c | ||
| of_numa.c | ||
| of_private.h | ||
| of_reserved_mem.c | ||
| of_test.c | ||
| overlay_test.c | ||
| overlay.c | ||
| pdt.c | ||
| platform.c | ||
| property.c | ||
| resolver.c | ||
| unittest.c | ||