Fix adcsensor crash

We were taking a reference to a temporary variable.
Change it so we don't.

Tested: Passed cycling script that exposed issue

Change-Id: I9226e3d11b5c892cdfe02f138680ed98844596ef
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/src/ADCSensorMain.cpp b/src/ADCSensorMain.cpp
index 1125c5f..9024eb9 100644
--- a/src/ADCSensorMain.cpp
+++ b/src/ADCSensorMain.cpp
@@ -69,13 +69,13 @@
     boost::container::flat_map<std::string, std::shared_ptr<ADCSensor>>&
         sensors,
     std::shared_ptr<sdbusplus::asio::connection>& dbusConnection,
-    const std::unique_ptr<boost::container::flat_set<std::string>>&
+    const std::shared_ptr<boost::container::flat_set<std::string>>&
         sensorsChanged)
 {
     auto getter = std::make_shared<GetSensorConfiguration>(
         dbusConnection,
         std::move([&io, &objectServer, &sensors, &dbusConnection,
-                   &sensorsChanged](
+                   sensorsChanged](
                       const ManagedObjectType& sensorConfigurations) {
             bool firstScan = sensorsChanged == nullptr;
             std::vector<fs::path> paths;
@@ -291,8 +291,8 @@
     sdbusplus::asio::object_server objectServer(systemBus);
     boost::container::flat_map<std::string, std::shared_ptr<ADCSensor>> sensors;
     std::vector<std::unique_ptr<sdbusplus::bus::match::match>> matches;
-    std::unique_ptr<boost::container::flat_set<std::string>> sensorsChanged =
-        std::make_unique<boost::container::flat_set<std::string>>();
+    auto sensorsChanged =
+        std::make_shared<boost::container::flat_set<std::string>>();
 
     io.post([&]() {
         createSensors(io, objectServer, sensors, systemBus, nullptr);
@@ -369,7 +369,7 @@
                     std::cerr << "timer error\n";
                     return;
                 }
-                createSensors(io, objectServer, sensors, systemBus, {});
+                createSensors(io, objectServer, sensors, systemBus, nullptr);
             });
         };