From: Ben Pfaff Date: Wed, 8 Oct 2008 21:09:18 +0000 (-0700) Subject: Implement dhclient_destroy(). X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=80a28d9455be2b940bf8bce32550141efdf4800b;hp=3bcc21747fd1c8b11a92624d97ce593ee3db1bd1;p=openvswitch Implement dhclient_destroy(). This function has always been prototyped in dhcp-client.h, but it had no users and never got implemented. --- diff --git a/lib/dhcp-client.c b/lib/dhcp-client.c index 70f4e60f..1e481cf8 100644 --- a/lib/dhcp-client.c +++ b/lib/dhcp-client.c @@ -206,6 +206,19 @@ dhclient_create(const char *netdev_name, return 0; } +/* Destroys 'cli' and frees all related resources. */ +void +dhclient_destroy(struct dhclient *cli) +{ + if (cli) { + dhcp_msg_uninit(cli->binding); + free(cli->binding); + netdev_close(cli->netdev); + ds_destroy(&cli->s); + free(cli); + } +} + /* Forces 'cli' into a (re)initialization state, in which no address is bound * but the client is advertising to obtain one. If 'requested_ip' is nonzero, * then the client will attempt to re-bind to that IP address; otherwise, it