Simplify code
So, our static analyzer complained about this code having a
use-after-free because of the const string&s here. This appears to be a
broken static analyzer, but I'm unsure:
- why this array has to be static, and
- why the string fields have to be const&
By the letter of the standard, this code will work without this patch,
but unless there's something subtle going on that requires these strings
to live forever (in which case, we should probably have a comment), I
think that making the code slightly simpler is a good thing.
No functional change is intended.
Bug: None
Test: Builds; tool is happier.
Change-Id: I1b953c579cea95f2a71d820b5026737057faeeb6
diff --git a/tests/binder_test.cpp b/tests/binder_test.cpp
index 6752ef1..d7df52d 100644
--- a/tests/binder_test.cpp
+++ b/tests/binder_test.cpp
@@ -260,11 +260,11 @@
}
TEST_F(BinderTest, TestVirtualTunnelInterface) {
- static const struct TestData {
- const std::string& family;
- const std::string& deviceName;
- const std::string& localAddress;
- const std::string& remoteAddress;
+ const struct TestData {
+ const std::string family;
+ const std::string deviceName;
+ const std::string localAddress;
+ const std::string remoteAddress;
int32_t iKey;
int32_t oKey;
} kTestData[] = {