From 437a2a9aa819b5e746fc2098a08577216f861efb Mon Sep 17 00:00:00 2001 From: Brendan Dougherty Date: Wed, 22 Nov 2023 02:55:41 +0000 Subject: [PATCH] vindexes: fix pooled collator buffer memory leak 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 {