* RemoveAddresses() needs to remove the addresses from the hash table as well.
This fixes random memory access on interface removal. * Optimized IndexOfAddress() for NULL addresses. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40447 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
0e4bbb1bee
commit
b0766602db
@ -679,6 +679,9 @@ Interface::AddressAt(size_t index)
|
||||
int32
|
||||
Interface::IndexOfAddress(InterfaceAddress* address)
|
||||
{
|
||||
if (address == NULL)
|
||||
return -1;
|
||||
|
||||
RecursiveLocker locker(fLock);
|
||||
|
||||
AddressList::Iterator iterator = fAddresses.GetIterator();
|
||||
@ -709,7 +712,15 @@ Interface::RemoveAddresses()
|
||||
RecursiveLocker locker(fLock);
|
||||
|
||||
while (InterfaceAddress* address = fAddresses.RemoveHead()) {
|
||||
locker.Unlock();
|
||||
|
||||
address->ReleaseReference();
|
||||
if (address->LocalIsDefined()) {
|
||||
MutexLocker hashLocker(sHashLock);
|
||||
sAddressTable.Remove(address);
|
||||
}
|
||||
|
||||
locker.Lock();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user