tests: fix use-after-free
sdbusplus::asio::connection saves a reference to the io context passed
to its constructor so we need to increase its scope.
Change-Id: Ia1bf05871329a06ec39e6c0cef17e92c0d37b138
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/src/test/util/asio_server_class.hpp b/src/test/util/asio_server_class.hpp
index 43afa87..28eb921 100644
--- a/src/test/util/asio_server_class.hpp
+++ b/src/test/util/asio_server_class.hpp
@@ -19,7 +19,7 @@
// NOTE - latest googltest changed to SetUpTestSuite()
static void SetUpTestCase()
{
- boost::asio::io_context io;
+ static boost::asio::io_context io;
auto conn = std::make_shared<sdbusplus::asio::connection>(io);
// Need a distinct name for the bus since multiple test applications