Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mdns-mdnssd] fix access of freed
mHostsRef
in Stop()
This commit updates `Stop()` method to clear the host and service registrations `mHostRegistrations` and `mServiceRegistrations` before de-allocating `mHostsRef`. This ensures that `mHostsRef` and all its child `DNSRecordRef`s remain valid when the `DnssdHostRegistration` destructor is called which accesses and uses these to update the published AAAA (IPv6 Address) records. This commit also updates how `kDNSServiceErr_ServiceNotRunning` is handled. Upon getting this error we need to clear all existing `ServiceRef`s immediately, so we de-allocate `mHostsRef` and then call `Stop()` followed by `Start()`. This commit also adds a check to ensure `mHostsRef` is valid in the `DnssdHostRegistration` destructor. This way the `Stop()` works correctly during normal stop process and also `kDNSServiceErr_ServiceNotRunning`
- Loading branch information