From ed67232f2af7a4f509f4a374874ccc977929fd84 Mon Sep 17 00:00:00 2001 From: chavacava Date: Sun, 17 Apr 2022 11:54:49 +0200 Subject: [PATCH 1/2] fix #1641 --- utils.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils.go b/utils.go index 3ebe7b297..c619f47d2 100644 --- a/utils.go +++ b/utils.go @@ -525,7 +525,7 @@ type hashWrapper struct { } // Close will put the hasher back into the pool. -func (m hashWrapper) Close() { +func (m *hashWrapper) Close() { if m.isMD5 && m.Hash != nil { m.Reset() md5Pool.Put(m.Hash) From 1f957bbe1f0d94ea1f81a5bd70bedcc5898d0003 Mon Sep 17 00:00:00 2001 From: chavacava Date: Tue, 19 Apr 2022 13:47:02 +0200 Subject: [PATCH 2/2] changes hasher constructors to return a pointer-to --- utils.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils.go b/utils.go index c619f47d2..11a4f3403 100644 --- a/utils.go +++ b/utils.go @@ -510,11 +510,11 @@ var ( ) func newMd5Hasher() md5simd.Hasher { - return hashWrapper{Hash: md5Pool.Get().(hash.Hash), isMD5: true} + return &hashWrapper{Hash: md5Pool.Get().(hash.Hash), isMD5: true} } func newSHA256Hasher() md5simd.Hasher { - return hashWrapper{Hash: sha256Pool.Get().(hash.Hash), isSHA256: true} + return &hashWrapper{Hash: sha256Pool.Get().(hash.Hash), isSHA256: true} } // hashWrapper implements the md5simd.Hasher interface.