1
0
mirror of https://git.zx2c4.com/wireguard-go synced 2024-11-15 01:05:15 +01:00

device: remove nil elem check in finalizers

This is not necessary, and removing it speeds up detection of UAF bugs.

Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
This commit is contained in:
Josh Bleecher Snyder 2021-02-09 08:15:21 -08:00 committed by Jason A. Donenfeld
parent 9e728c2eb0
commit ecceaadd16

View File

@ -87,9 +87,6 @@ func newAutodrainingInboundQueue(device *Device) *autodrainingInboundQueue {
for {
select {
case elem := <-q.c:
if elem == nil {
continue
}
elem.Lock()
device.PutMessageBuffer(elem.buffer)
device.PutInboundElement(elem)
@ -118,9 +115,6 @@ func newAutodrainingOutboundQueue(device *Device) *autodrainingOutboundQueue {
for {
select {
case elem := <-q.c:
if elem == nil {
continue
}
elem.Lock()
device.PutMessageBuffer(elem.buffer)
device.PutOutboundElement(elem)