mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-03-28 06:28:39 +00:00
Let's make sure to clean up our memory
This commit is contained in:
parent
d6e3164ea1
commit
b9a1719cb1
@ -61,12 +61,29 @@ void MacDNSHelper::setDNS(uint64_t nwid, const char *domain, const std::vector<I
|
||||
fprintf(stderr, "Error writing DNS configuration\n");
|
||||
}
|
||||
|
||||
CFRelease(list);
|
||||
CFRelease(key);
|
||||
CFRelease(dict);
|
||||
CFRelease(domainArray);
|
||||
CFRelease(cfdomain);
|
||||
CFRelease(serverArray);
|
||||
for (int i = 0; i < servers.size(); ++i) {
|
||||
CFRelease(s[i]);
|
||||
}
|
||||
delete[] s;
|
||||
CFRelease(ds);
|
||||
}
|
||||
|
||||
void MacDNSHelper::removeDNS(uint64_t nwid)
|
||||
{
|
||||
SCDynamicStoreRef ds = SCDynamicStoreCreate(NULL, CFSTR("zerotier"), NULL, NULL);
|
||||
|
||||
char buf[256] = {0};
|
||||
sprintf(buf, "State:/Network/Service/%.16llx/DNS", nwid);
|
||||
CFStringRef key = CFStringCreateWithCString(NULL, buf, kCFStringEncodingUTF8);
|
||||
SCDynamicStoreRemoveValue(ds, key);
|
||||
CFRelease(key);
|
||||
CFRelease(ds);
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user