diff options
author | Jonathan Doman <jonathan.doman@intel.com> | 2023-08-18 04:19:19 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2023-08-21 20:53:26 +0300 |
commit | 5ab47856f8499a5d2d393d1584b8fc402399eddf (patch) | |
tree | 61b30bd003b30361fc7747993d9feed7514a9d4c /include/dbus_privileges.hpp | |
parent | 7aa9ab0be913a433a42f4815d2ec49111abc9e4d (diff) | |
download | bmcweb-5ab47856f8499a5d2d393d1584b8fc402399eddf.tar.xz |
Fix duplicate entries in session userGroups
The user's groups were getting re-appended in the session object on
every request, resulting in a small memory leak (that does clear away
when the session is ended). Fix by just overwriting instead of
appending.
Tested: Added debug prints in ~UserSession to check contents of
userGroups, then ran multiple GETs to /redfish/v1 via token auth, then
destroyed session via WebUI and confirmed userGroups contained correct
set of groups.
Change-Id: I7c04a18437f69a97f138ff1f9aeee2731952ae8b
Signed-off-by: Jonathan Doman <jonathan.doman@intel.com>
Diffstat (limited to 'include/dbus_privileges.hpp')
-rw-r--r-- | include/dbus_privileges.hpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/include/dbus_privileges.hpp b/include/dbus_privileges.hpp index fca4a137d3..7fb545a9c1 100644 --- a/include/dbus_privileges.hpp +++ b/include/dbus_privileges.hpp @@ -83,11 +83,11 @@ inline bool if (userGroups != nullptr) { - // Populate session with user groups. - for (const auto& userGroup : *userGroups) - { - req.session->userGroups.emplace_back(userGroup); - } + req.session->userGroups = *userGroups; + } + else + { + req.session->userGroups.clear(); } return true; |