registry: acquire mutex in IsInsecureRegistry

The mutex needs to be held when accessing s.config to prevent data
races.

Signed-off-by: Cory Snider <csnider@mirantis.com>
This commit is contained in:
Cory Snider 2023-02-28 19:42:49 -05:00
parent a48f19157a
commit 19ad4ac03d

View file

@ -237,5 +237,7 @@ func (s *defaultService) LookupPushEndpoints(hostname string) (endpoints []APIEn
// IsInsecureRegistry returns true if the registry at given host is configured as
// insecure registry.
func (s *defaultService) IsInsecureRegistry(host string) bool {
s.mu.RLock()
defer s.mu.RUnlock()
return !s.config.isSecureIndex(host)
}