Fix leaking slices

This commit is contained in:
Ingo Oppermann
2025-07-09 14:57:25 +02:00
parent 2beb9d529e
commit e6b90c9657
2 changed files with 14 additions and 15 deletions

View File

@@ -29,23 +29,17 @@ func (a *policyAdapter) LoadPolicy(model policy.Model) error {
domains := map[string]struct{}{}
for _, p := range storePolicies.Policies {
if len(p.Domain) == 0 {
p.Domain = "$none"
policy := p.Clone()
if len(policy.Domain) == 0 {
policy.Domain = "$none"
}
if len(p.Types) == 0 {
p.Types = []string{"$none"}
if len(policy.Types) == 0 {
policy.Types = []string{"$none"}
}
policy := policy.Policy{
Name: p.Name,
Domain: p.Domain,
Types: p.Types,
Resource: p.Resource,
Actions: p.Actions,
}
domains[p.Domain] = struct{}{}
domains[policy.Domain] = struct{}{}
policies = append(policies, policy)
}