From e5b04c8de83aa17e324bae95f18a822931fb8078 Mon Sep 17 00:00:00 2001 From: Patrik Flykt Date: Wed, 9 Apr 2014 13:12:07 +0300 Subject: 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. --- src/network/networkd-link.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/network') diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index f076525539..2630b4625a 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -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); -- cgit v1.2.3-54-g00ecf