[Concept,32/33] test: setexpr: Unset test env var in str_long()

Message ID 20260416023021.626949-33-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 test uses 'setexpr.s' to set the env variable 'fred' to a 64K
string, but never unsets it. The env machinery allocated the value, so
running the test leaves 64K hanging off the env hash forever.

Unset 'fred' at the end of the test.

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

 test/cmd/setexpr.c | 1 +
 1 file changed, 1 insertion(+)
  

Patch

diff --git a/test/cmd/setexpr.c b/test/cmd/setexpr.c
index 93b0c4b68f5..4e3a2f7aaa4 100644
--- a/test/cmd/setexpr.c
+++ b/test/cmd/setexpr.c
@@ -360,6 +360,7 @@  static int setexpr_test_str_long(struct unit_test_state *uts)
 	ut_asserteq(64 << 10, strlen(val));
 
 	unmap_sysmem(buf);
+	env_set("fred", NULL);
 
 	return 0;
 }