[management] create a shallow copy of the account when buffering (#5572)

This commit is contained in:
Pascal Fischer
2026-03-11 13:01:13 +01:00
committed by GitHub
parent 5585adce18
commit 11f891220e

View File

@@ -86,7 +86,14 @@ func (ac *AccountRequestBuffer) processGetAccountBatch(ctx context.Context, acco
result := &AccountResult{Account: account, Err: err} result := &AccountResult{Account: account, Err: err}
for _, req := range requests { for _, req := range requests {
req.ResultChan <- result if account != nil {
// Shallow copy the account so each goroutine gets its own struct value.
// This prevents data races when callers mutate fields like Policies.
accountCopy := *account
req.ResultChan <- &AccountResult{Account: &accountCopy, Err: err}
} else {
req.ResultChan <- result
}
close(req.ResultChan) close(req.ResultChan)
} }
} }