Skip to content

Commit

Permalink
Adds missing Close() calls
Browse files Browse the repository at this point in the history
  • Loading branch information
chripo committed Feb 9, 2023
1 parent 76fcd60 commit dc3365d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion auth.go
Expand Up @@ -196,17 +196,20 @@ func (s *authShim) Verify(c *http.Client, rs *http.Response, path string) (reaut
reauth, err = s.auth.Verify(c, rs, path)
if err != nil && errors.Is(err, ErrAuthChanged) {
if auth, aerr := s.factory(c, rs, path); aerr == nil {
s.auth.Close()
s.auth = auth
return true, nil
} else {
err = aerr
return false, aerr
}
}
return
}

// Close closes all resources
func (s *authShim) Close() error {
s.auth.Close()
s.auth, s.factory = nil, nil
if s.body != nil {
if closer, ok := s.body.(io.Closer); ok {
return closer.Close()
Expand Down

0 comments on commit dc3365d

Please sign in to comment.