mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
netstack: check the value of IncRef() before returning a selected source IP
It's possible for IncRef() to fail (it's really TryIncRef()), so we have to check. PiperOrigin-RevId: 572068691
This commit is contained in:
committed by
gVisor bot
parent
b3de4851a6
commit
19399cd60b
@@ -480,10 +480,9 @@ func (a *AddressableEndpointState) acquirePrimaryAddressRLocked(remoteAddr tcpip
|
||||
bestLen = stateLen
|
||||
}
|
||||
}
|
||||
if best != nil {
|
||||
best.IncRef()
|
||||
if best != nil && best.IncRef() {
|
||||
return best
|
||||
}
|
||||
return best
|
||||
}
|
||||
|
||||
var deprecatedEndpoint *addressState
|
||||
|
||||
Reference in New Issue
Block a user