zeroconf/Bonjour: don't call DNSServiceRefDeallocate() if DNSServiceRegister() fails
According to https://developer.apple.com/documentation/dnssd/1804733-dnsserviceregister the DNSServiceRef is initialized only if DNSServiceRegister() returns kDNSServiceErr_NoError. The faulty error handling code could therefore crash.
This commit is contained in:
parent
04d5588fe5
commit
47461df59c
@ -97,11 +97,6 @@ BonjourInit(EventLoop &loop, const char *service_name, unsigned port)
|
|||||||
if (error != kDNSServiceErr_NoError) {
|
if (error != kDNSServiceErr_NoError) {
|
||||||
LogError(bonjour_domain,
|
LogError(bonjour_domain,
|
||||||
"Failed to register zeroconf service");
|
"Failed to register zeroconf service");
|
||||||
|
|
||||||
if (dnsReference) {
|
|
||||||
DNSServiceRefDeallocate(dnsReference);
|
|
||||||
dnsReference = nullptr;
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user