Fix bug where the defensive copy loses the computed leaf paths. #401

Merged
telackey merged 1 commits from telackey/copyfix2 into v1.11.6-statediff-v5 2023-07-21 23:46:18 +00:00

View File

@ -88,9 +88,9 @@ type ParamsWithMutex struct {
// CopyParams returns a defensive copy of the Params // CopyParams returns a defensive copy of the Params
func (p *ParamsWithMutex) CopyParams() Params { func (p *ParamsWithMutex) CopyParams() Params {
p.RLock() p.RLock()
defer p.RUnlock()
copy := p.Params.Copy() copy := p.Params.Copy()
p.RUnlock()
copy.ComputeWatchedAddressesLeafPaths() copy.ComputeWatchedAddressesLeafPaths()
return copy return copy
} }