mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-22 10:07:12 +00:00
Merge Fix memory leak in aare_rules UniquePermsCache
When the find fails but the insertion also fails, we leak the new node that we generated. Delete the new node in this case to avoid leaking memory. The question remains, however, as to whether we should implement `operator==` in addition to `operator<` so that they are consistent with each other and `find` works correctly. Signed-off-by: Ryan Lee <ryan.lee@canonical.com> MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1399 Approved-by: Georgia Garcia <georgia.garcia@canonical.com> Merged-by: John Johansen <john@jjmx.net>
This commit is contained in:
commit
99261bad11
@ -90,8 +90,10 @@ public:
|
||||
else
|
||||
node = new MatchFlag(priority, perms, audit);
|
||||
pair<iterator, bool> val = nodes.insert(make_pair(tmp, node));
|
||||
if (val.second == false)
|
||||
if (val.second == false) {
|
||||
delete node;
|
||||
return val.first->second;
|
||||
}
|
||||
return node;
|
||||
}
|
||||
return res->second;
|
||||
|
Loading…
x
Reference in New Issue
Block a user