Dbus_Rest: Fix bmcweb crash
GET on URI "/bus/system/" causes bmcweb service to crash.
This occurred as asyncResp was captured by reference by lambda.
Tested:
- GET on /bus/system/ responded with desired output without crash.
Signed-off-by: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com>
Change-Id: I2c777be4bc2c95332d47df380c867891b133d016
diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp
index 298298b..3188188 100644
--- a/include/openbmc_dbus_rest.hpp
+++ b/include/openbmc_dbus_rest.hpp
@@ -2081,7 +2081,7 @@
.methods(boost::beast::http::verb::get)(
[](const crow::Request&,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
- auto myCallback = [&asyncResp](
+ auto myCallback = [asyncResp](
const boost::system::error_code ec,
std::vector<std::string>& names) {
if (ec)