mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-28 21:07:56 +00:00
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. Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
This commit is contained in:
parent
8d6270e1fe
commit
81950dae4e
@ -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