Fix use-after-free in unittest setup code.
When setting the root prefix in a unittest, we need to reset it after
so it isn't accidentally used by other tests.
Bug: chromium:547127
Test: USE="clang asan" FEATURES=test emerge-link update_engine
Change-Id: Ib84bbf265a380976407100a4fba4d2600d62dde6
diff --git a/omaha_request_params_unittest.cc b/omaha_request_params_unittest.cc
index 9ee2a66..473b101 100644
--- a/omaha_request_params_unittest.cc
+++ b/omaha_request_params_unittest.cc
@@ -357,6 +357,7 @@
EXPECT_FALSE(params.is_powerwash_allowed());
}
OmahaRequestParams out(&fake_system_state_);
+ out.set_root(test_dir_);
EXPECT_TRUE(DoTest(&out, "", ""));
EXPECT_EQ("canary-channel", out.target_channel());
EXPECT_FALSE(out.is_powerwash_allowed());
@@ -378,6 +379,7 @@
EXPECT_TRUE(params.is_powerwash_allowed());
}
OmahaRequestParams out(&fake_system_state_);
+ out.set_root(test_dir_);
EXPECT_TRUE(DoTest(&out, "", ""));
EXPECT_EQ("canary-channel", out.target_channel());
EXPECT_TRUE(out.is_powerwash_allowed());
@@ -400,6 +402,7 @@
EXPECT_FALSE(params.is_powerwash_allowed());
}
OmahaRequestParams out(&fake_system_state_);
+ out.set_root(test_dir_);
EXPECT_TRUE(DoTest(&out, "", ""));
EXPECT_EQ("arm-generic", out.os_board());
EXPECT_EQ("dev-channel", out.target_channel());