]> Cypherpunks.ru repositories - gostls13.git/commit
slices: zero the slice elements discarded by Delete, DeleteFunc, Compact, CompactFunc...
authorDeleplace <deleplace@google.com>
Mon, 13 Nov 2023 08:32:33 +0000 (09:32 +0100)
committerGopher Robot <gobot@golang.org>
Tue, 14 Nov 2023 17:12:38 +0000 (17:12 +0000)
commite21dc702d54e85381a97259db7deec710108279b
tree754180d8a018bfce7d3f18d7be9c447992525e63
parente14b96cb511ab3437dedf2be2fa49d4516189bbc
slices: zero the slice elements discarded by Delete, DeleteFunc, Compact, CompactFunc, Replace.

To avoid memory leaks in slices that contain pointers, clear the elements between the new length and the original length.

Fixes #63393

Change-Id: Ic65709726f4479d70c6bce14aa367feb753d41da
Reviewed-on: https://go-review.googlesource.com/c/go/+/541477
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/slices/slices.go
src/slices/slices_test.go