[Concept,28/33] test: lib: Dispose tree in json_to_fdt_luks2()

Message ID 20260416023021.626949-29-sjg@u-boot.org
State New
Headers
Series Fix memory leaks and test pollution in sandbox tests |

Commit Message

Simon Glass April 16, 2026, 2:29 a.m. UTC
  From: Simon Glass <sjg@chromium.org>

This function creates a live tree via oftree_from_fdt() but never
disposes if it, leaking ~2.7K of ofnode state.

Dispose of the tree before returning.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 test/lib/json.c | 1 +
 1 file changed, 1 insertion(+)
  

Patch

diff --git a/test/lib/json.c b/test/lib/json.c
index 0cddddcb2a3..1c5c9215cc3 100644
--- a/test/lib/json.c
+++ b/test/lib/json.c
@@ -539,6 +539,7 @@  static int lib_test_json_to_fdt_luks2(struct unit_test_state *uts)
 	/* Check keyslots_size (stored as string in JSON) */
 	ut_asserteq_str("3145728", ofnode_read_string(config, "keyslots_size"));
 
+	oftree_dispose(tree);
 	abuf_uninit(&buf);
 
 	return 0;