diff options
author | Ed Tanous <edtanous@google.com> | 2021-09-24 21:55:44 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2021-09-30 19:31:15 +0300 |
commit | 1106333af4a5b566d8b3686b3438ddebc75b1b5d (patch) | |
tree | 31fd42b3019e5a155717ed3921933e893c756ee4 /redfish-core/lib | |
parent | 567e3ab77c0770da7def4352808e2744aa13369e (diff) | |
download | bmcweb-1106333af4a5b566d8b3686b3438ddebc75b1b5d.tar.xz |
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
Diffstat (limited to 'redfish-core/lib')
-rw-r--r-- | redfish-core/lib/account_service.hpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp index e6fe2051d0..cfd47a85c5 100644 --- a/redfish-core/lib/account_service.hpp +++ b/redfish-core/lib/account_service.hpp @@ -1143,9 +1143,9 @@ inline void updateUserProperties(std::shared_ptr<bmcweb::AsyncResp> asyncResp, 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( |