Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

suspicious assignment to a by-value method receiver #1641

Closed
chavacava opened this issue Apr 17, 2022 · 0 comments · Fixed by #1642
Closed

suspicious assignment to a by-value method receiver #1641

chavacava opened this issue Apr 17, 2022 · 0 comments · Fixed by #1642
Assignees
Labels

Comments

@chavacava
Copy link
Contributor

In the code below, m.Hash = nil (line 537) will not affect the original hash wrapper because it is passed as a by-value receiver.

minio-go/utils.go

Lines 528 to 538 in 8142170

func (m hashWrapper) Close() {
if m.isMD5 && m.Hash != nil {
m.Reset()
md5Pool.Put(m.Hash)
}
if m.isSHA256 && m.Hash != nil {
m.Reset()
sha256Pool.Put(m.Hash)
}
m.Hash = nil
}

(Found with revive)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants