• R/O
  • HTTP
  • SSH
  • HTTPS

vapor: 提交

Golang implemented sidechain for Bytom


Commit MetaInfo

修订版45b11776fb251b712e0b11ec05fb54bb86ad1777 (tree)
时间2021-01-26 16:49:54
作者paladz <colt@Colt...>
Commiterpaladz

Log Message

try to fix the leak

更改概述

差异

--- a/crypto/sha3pool/pool.go
+++ b/crypto/sha3pool/pool.go
@@ -2,25 +2,18 @@
22 package sha3pool
33
44 import (
5- "sync"
6-
75 "golang.org/x/crypto/sha3"
86 )
97
10-var pool = &sync.Pool{New: func() interface{} { return sha3.New256() }}
11-
128 // Get256 returns an initialized SHA3-256 hash ready to use.
139 // It is like sha3.New256 except it uses the freelist.
1410 // The caller should call Put256 when finished with the returned object.
1511 func Get256() sha3.ShakeHash {
16- return pool.Get().(sha3.ShakeHash)
12+ return sha3.New256().(sha3.ShakeHash)
1713 }
1814
1915 // Put256 resets h and puts it in the freelist.
20-func Put256(h sha3.ShakeHash) {
21- h.Reset()
22- pool.Put(h)
23-}
16+func Put256(h sha3.ShakeHash) {}
2417
2518 // Sum256 uses a ShakeHash from the pool to sum into hash.
2619 func Sum256(hash, data []byte) {
Show on old repository browser