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:
parent
9e728c2eb0
commit
ecceaadd16
|
@ -87,9 +87,6 @@ func newAutodrainingInboundQueue(device *Device) *autodrainingInboundQueue {
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case elem := <-q.c:
|
case elem := <-q.c:
|
||||||
if elem == nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
elem.Lock()
|
elem.Lock()
|
||||||
device.PutMessageBuffer(elem.buffer)
|
device.PutMessageBuffer(elem.buffer)
|
||||||
device.PutInboundElement(elem)
|
device.PutInboundElement(elem)
|
||||||
|
@ -118,9 +115,6 @@ func newAutodrainingOutboundQueue(device *Device) *autodrainingOutboundQueue {
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case elem := <-q.c:
|
case elem := <-q.c:
|
||||||
if elem == nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
elem.Lock()
|
elem.Lock()
|
||||||
device.PutMessageBuffer(elem.buffer)
|
device.PutMessageBuffer(elem.buffer)
|
||||||
device.PutOutboundElement(elem)
|
device.PutOutboundElement(elem)
|
||||||
|
|
Loading…
Reference in a new issue