UDP: Fix double-reference of DomainSupport.

PulkoMandy in cb3199681e changed
the _GetDomainSupport functions to always Ref() the the object.
However, that means in the case of the second _GetDomainSupport
function, which is implemented in terms of the first, we should
not call Ref() as this will create a double-reference.

Fixes a memory leak.

Change-Id: Ib82b2dadc0c8cc8d8f95efcffeb2430ac602a0a9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4791
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
This commit is contained in:
Augustin Cavalier 2021-12-15 12:40:59 -05:00 committed by Axel Dörfler
parent c1e0007eea
commit e94ea7bc22

View File

@ -929,10 +929,7 @@ UdpEndpointManager::_GetDomainSupport(net_buffer* buffer)
{
MutexLocker _(fLock);
UdpDomainSupport* support = _GetDomainSupport(_GetDomain(buffer), false);
if (support != NULL)
support->Ref();
return support;
return _GetDomainSupport(_GetDomain(buffer), false);
}