Fix use after move in account service
A clang analyzer was able to find this issue.
dbus::utility::checkDbusPathExists(
dbusObjectPath,
[dbusObjectPath(std::move(dbusObjectPath)), username,
password(std::move(password)), roleId(std::move(roleId)), enabled,
locked, asyncResp{std::move(asyncResp)}](int rc) {
"Object 'dbusObjectPath' of type 'std::basic_string' is left in a valid
but unspecified state after move"
This is obviously a mistake, but apparently the undefined behavior works
for us. This commit makes it so we no longer rely on UB.
Tested: Trivial change, code compiles.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I1b82778cb74f4e5abc53edec35a6d276161de1af
diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp
index e6fe205..cfd47a8 100644
--- a/redfish-core/lib/account_service.hpp
+++ b/redfish-core/lib/account_service.hpp
@@ -1143,9 +1143,9 @@
dbus::utility::checkDbusPathExists(
dbusObjectPath,
- [dbusObjectPath(std::move(dbusObjectPath)), username,
- password(std::move(password)), roleId(std::move(roleId)), enabled,
- locked, asyncResp{std::move(asyncResp)}](int rc) {
+ [dbusObjectPath, username, password(std::move(password)),
+ roleId(std::move(roleId)), enabled, locked,
+ asyncResp{std::move(asyncResp)}](int rc) {
if (!rc)
{
messages::resourceNotFound(