aboutsummaryrefslogtreecommitdiff
path: root/device/pools.go
diff options
context:
space:
mode:
authorJosh Bleecher Snyder <josh@tailscale.com>2020-12-04 15:36:21 -0800
committerJosh Bleecher Snyder <josh@tailscale.com>2020-12-08 14:25:02 -0800
commitd3ff2d6b62b095f37582affe84e267d7e5be88c6 (patch)
tree9d97ec1ba73e2d7024bc3593c29c679763ad62c1 /device/pools.go
parent01d3aaa7f418dd0ca86643ddcc8c82544cb8398b (diff)
downloadwireguard-go-d3ff2d6b62b095f37582affe84e267d7e5be88c6.tar.gz
wireguard-go-d3ff2d6b62b095f37582affe84e267d7e5be88c6.zip
device: clear pointers when returning elems to pools
Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
Diffstat (limited to 'device/pools.go')
-rw-r--r--device/pools.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/device/pools.go b/device/pools.go
index e778d2e..6939eeb 100644
--- a/device/pools.go
+++ b/device/pools.go
@@ -65,6 +65,7 @@ func (device *Device) GetInboundElement() *QueueInboundElement {
}
func (device *Device) PutInboundElement(msg *QueueInboundElement) {
+ msg.clearPointers()
if PreallocatedBuffersPerPool == 0 {
device.pool.inboundElementPool.Put(msg)
} else {
@@ -81,6 +82,7 @@ func (device *Device) GetOutboundElement() *QueueOutboundElement {
}
func (device *Device) PutOutboundElement(msg *QueueOutboundElement) {
+ msg.clearPointers()
if PreallocatedBuffersPerPool == 0 {
device.pool.outboundElementPool.Put(msg)
} else {