sd-dhcp-client: Add reference counting for DHCP
The DHCP library user can decide to free the DHCP client any time the callback is called. After the callback has been called, other computations may still be needed - the best example being a full restart of the DHCP procedure in case of lease expiry. Fix this by introducing proper reference counting. Properly handle a returned NULL from the notify and stop functions if the DHCP client was freed.
This commit is contained in:
@@ -80,7 +80,7 @@ void link_free(Link *link) {
|
||||
|
||||
assert(link->manager);
|
||||
|
||||
sd_dhcp_client_free(link->dhcp_client);
|
||||
sd_dhcp_client_unref(link->dhcp_client);
|
||||
sd_dhcp_lease_unref(link->dhcp_lease);
|
||||
|
||||
sd_ipv4ll_free(link->ipv4ll);
|
||||
|
||||
Reference in New Issue
Block a user