From 05d4ea5cea681a73c43e3e0107003bd79ca40c95 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 {