Skip to content

Commit

Permalink
vindexes: fix pooled collator buffer memory leak
Browse files Browse the repository at this point in the history
Signed-off-by: Brendan Dougherty <[email protected]>
  • Loading branch information
brendar committed Nov 27, 2023
1 parent 2ebfdb0 commit 05d4ea5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion go/vt/vtgate/vindexes/unicode.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ import (

func unicodeHash(hashFunc func([]byte) []byte, key sqltypes.Value) ([]byte, error) {
collator := collatorPool.Get().(*pooledCollator)
defer collatorPool.Put(collator)
defer func() {
collator.buf.Reset()
collatorPool.Put(collator)
}()

keyBytes, err := key.ToBytes()
if err != nil {
Expand Down

0 comments on commit 05d4ea5

Please sign in to comment.