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/libsystemd-network/test-dhcp-client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/libsystemd-network/test-dhcp-client.c') diff --git a/src/libsystemd-network/test-dhcp-client.c b/src/libsystemd-network/test-dhcp-client.c index 71b06b17a9..9c316d75bc 100644 --- a/src/libsystemd-network/test-dhcp-client.c +++ b/src/libsystemd-network/test-dhcp-client.c @@ -251,7 +251,7 @@ static void test_discover_message(sd_event *e) sd_event_run(e, (uint64_t) -1); sd_dhcp_client_stop(client); - sd_dhcp_client_free(client); + sd_dhcp_client_unref(client); test_fd[1] = safe_close(test_fd[1]); @@ -476,7 +476,7 @@ static void test_addr_acq(sd_event *e) { sd_dhcp_client_set_callback(client, NULL, NULL); sd_dhcp_client_stop(client); - sd_dhcp_client_free(client); + sd_dhcp_client_unref(client); test_fd[1] = safe_close(test_fd[1]); -- cgit v1.2.3-54-g00ecf