summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrik Flykt <patrik.flykt@linux.intel.com>2013-12-09 23:43:32 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-12-12 11:43:34 -0500
commitd2fe46b514ef3f6e0c0eb16b2d853c6dd6fa1808 (patch)
treed4885e3b0b6521f47134086d488aa4aa603393ec
parent751246ee37cf0cd72baf378f1b9c1ac04f8b8c9b (diff)
dhcp: Add function to free DHCP client data
-rw-r--r--src/libsystemd-dhcp/dhcp-client.c13
-rw-r--r--src/systemd/sd-dhcp-client.h1
2 files changed, 14 insertions, 0 deletions
diff --git a/src/libsystemd-dhcp/dhcp-client.c b/src/libsystemd-dhcp/dhcp-client.c
index 03a846df39..01d406c27b 100644
--- a/src/libsystemd-dhcp/dhcp-client.c
+++ b/src/libsystemd-dhcp/dhcp-client.c
@@ -961,6 +961,19 @@ int sd_dhcp_client_stop(sd_dhcp_client *client)
return client_stop(client, DHCP_EVENT_STOP);
}
+sd_dhcp_client *sd_dhcp_client_free(sd_dhcp_client *client)
+{
+ assert_return(client, NULL);
+
+ sd_dhcp_client_stop(client);
+
+ sd_event_unref(client->event);
+ free(client->req_opts);
+ free(client);
+
+ return NULL;
+}
+
sd_dhcp_client *sd_dhcp_client_new(sd_event *event)
{
sd_dhcp_client *client;
diff --git a/src/systemd/sd-dhcp-client.h b/src/systemd/sd-dhcp-client.h
index 395c12d253..fdc5b2dcba 100644
--- a/src/systemd/sd-dhcp-client.h
+++ b/src/systemd/sd-dhcp-client.h
@@ -57,6 +57,7 @@ int sd_dhcp_client_get_router(sd_dhcp_client *client, struct in_addr *addr);
int sd_dhcp_client_stop(sd_dhcp_client *client);
int sd_dhcp_client_start(sd_dhcp_client *client);
+sd_dhcp_client *sd_dhcp_client_free(sd_dhcp_client *client);
sd_dhcp_client *sd_dhcp_client_new(sd_event *event);
#endif