Commit 47461df5 authored by Max Kellermann's avatar Max Kellermann

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.
parent 04d5588f
......@@ -97,11 +97,6 @@ BonjourInit(EventLoop &loop, const char *service_name, unsigned port)
if (error != kDNSServiceErr_NoError) {
LogError(bonjour_domain,
"Failed to register zeroconf service");
if (dnsReference) {
DNSServiceRefDeallocate(dnsReference);
dnsReference = nullptr;
}
return;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment