diff options
author | Krzysztof Grobelny <krzysztof.grobelny@intel.com> | 2021-04-16 16:15:21 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2021-04-20 09:41:47 +0300 |
commit | d51e072fa60348422d6a145d76d7506de2bca4d6 (patch) | |
tree | 1f7f391b7bb0ab34b0383f8cfa21e8d4fb7c84c5 /redfish-core/lib/sensors.hpp | |
parent | 3e919b5857555e95d5348028bdc7393b9a1eca1a (diff) | |
download | bmcweb-d51e072fa60348422d6a145d76d7506de2bca4d6.tar.xz |
fixed crash in getChassisData
crow::Response was create on stack and passed to async function
which was called after crow::Response was deleted
Tested:
- mentioned issue doesn't produce errors anymore
- no additional errors detected
Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
Change-Id: I16b338e0f6a4102415b5dca5defc307495db0c8e
Diffstat (limited to 'redfish-core/lib/sensors.hpp')
-rw-r--r-- | redfish-core/lib/sensors.hpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp index 51401809d8..b20f7ebc22 100644 --- a/redfish-core/lib/sensors.hpp +++ b/redfish-core/lib/sensors.hpp @@ -3092,16 +3092,17 @@ inline void retrieveUriToDbusMap(const std::string& chassis, mapComplete(boost::beast::http::status::bad_request, {}); return; } - crow::Response res; - auto respBuffer = std::make_shared<bmcweb::AsyncResp>(res); + + auto res = std::make_shared<crow::Response>(); + auto asyncResp = std::make_shared<bmcweb::AsyncResp>(*res); auto callback = - [respBuffer, mapCompleteCb{std::move(mapComplete)}]( + [res, asyncResp, mapCompleteCb{std::move(mapComplete)}]( const boost::beast::http::status status, const boost::container::flat_map<std::string, std::string>& uriToDbus) { mapCompleteCb(status, uriToDbus); }; auto resp = std::make_shared<SensorsAsyncResp>( - respBuffer, chassis, pathIt->second, node, std::move(callback)); + asyncResp, chassis, pathIt->second, node, std::move(callback)); getChassisData(resp); } |