Fix decay time env variable test.
The test was trying to use the actual pointer to a testing argv value.
The pointer seems to always go away under mte, and should not have been
used like this. Instead make a copy of the first argument to use for
execv so the pointer is always valid.
Bug: 402972252
Test: All unit tests pass on fullmte build.
Change-Id: I31e860306a0a725727f5947653ed9ae80f6f9ba0
diff --git a/tests/malloc_test.cpp b/tests/malloc_test.cpp
index 37c1ef0..db814dc 100644
--- a/tests/malloc_test.cpp
+++ b/tests/malloc_test.cpp
@@ -1800,10 +1800,10 @@
// fork'd and exec'd processes.
ASSERT_EQ(0, setenv("MALLOC_USE_APP_DEFAULTS", "1", 1));
ExecTestHelper eth;
- eth.SetArgs({testing::internal::GetArgvs()[0].c_str(), "--gtest_also_run_disabled_tests",
+ std::string executable(testing::internal::GetArgvs()[0]);
+ eth.SetArgs({executable.c_str(), "--gtest_also_run_disabled_tests",
"--gtest_filter=android_mallopt.DISABLED_verify_decay_time_on", nullptr});
- eth.Run([&]() { execv(testing::internal::GetArgvs()[0].c_str(), eth.GetArgs()); }, 0,
- R"(\[ PASSED \] 1 test)");
+ eth.Run([&]() { execv(executable.c_str(), eth.GetArgs()); }, 0, R"(\[ PASSED \] 1 test)");
#else
GTEST_SKIP() << "bionic-only test";
#endif