device: clear pointers when returning elems to pools
Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
This commit is contained in:
parent
01d3aaa7f4
commit
d3ff2d6b62
3 changed files with 24 additions and 1 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue