From 9de49af6e3dddd4b937ded2557092e627fac970d Mon Sep 17 00:00:00 2001 From: "vitess-bot[bot]" <108069721+vitess-bot[bot]@users.noreply.github.com> Date: Mon, 27 Nov 2023 11:15:09 -0500 Subject: [PATCH] vindexes: fix pooled collator buffer memory leak (#14621) Signed-off-by: Brendan Dougherty --- go/vt/vtgate/vindexes/unicode.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/go/vt/vtgate/vindexes/unicode.go b/go/vt/vtgate/vindexes/unicode.go index bbf0be16c1d..6711f77c7d9 100644 --- a/go/vt/vtgate/vindexes/unicode.go +++ b/go/vt/vtgate/vindexes/unicode.go @@ -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 {