]> Cypherpunks repositories - gostls13.git/commit
unique: don't retain uncloned input as key
authorMichael Anthony Knyszek <mknyszek@google.com>
Wed, 4 Sep 2024 16:46:33 +0000 (16:46 +0000)
committerGopher Robot <gobot@golang.org>
Wed, 4 Sep 2024 18:13:29 +0000 (18:13 +0000)
commit21ac23a96f204dfb558a8d3071380c1d105a93ba
tree7b5089e85cd4df721f9f8813bcb1a7563c3f7555
parent79fd633632cdbaf9ca38f7559e5abb5c07fbbd9d
unique: don't retain uncloned input as key

Currently the unique package tries to clone strings that get stored in
its internal map to avoid retaining large strings.

However, this falls over entirely due to the fact that the original
string is *still* stored in the map as a key. Whoops. Fix this by
storing the cloned value in the map instead.

This change also adds a test which fails without this change.

Change-Id: I1a6bb68ed79b869ea12ab6be061a5ae4b4377ddb
Reviewed-on: https://go-review.googlesource.com/c/go/+/610738
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/unique/handle.go
src/unique/handle_test.go