From: Yu Watanabe Date: Fri, 21 Jun 2019 03:06:56 +0000 (+0900) Subject: network: split link_free() into two parts X-Git-Tag: v244~204^2~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1a6bb31faedf6d6feae2a42a6aa02105181d8aea;p=platform%2Fupstream%2Fsystemd.git network: split link_free() into two parts --- diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index 897a2b2..6c1cb45 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -661,6 +661,25 @@ void link_dns_settings_clear(Link *link) { link->dnssec_negative_trust_anchors = set_free_free(link->dnssec_negative_trust_anchors); } +static void link_free_engines(Link *link) { + if (!link) + return; + + link->dhcp_server = sd_dhcp_server_unref(link->dhcp_server); + link->dhcp_client = sd_dhcp_client_unref(link->dhcp_client); + link->dhcp_lease = sd_dhcp_lease_unref(link->dhcp_lease); + link->dhcp_routes = set_free(link->dhcp_routes); + + link->lldp = sd_lldp_unref(link->lldp); + + ndisc_flush(link); + + link->ipv4ll = sd_ipv4ll_unref(link->ipv4ll); + link->dhcp6_client = sd_dhcp6_client_unref(link->dhcp6_client); + link->ndisc = sd_ndisc_unref(link->ndisc); + link->radv = sd_radv_unref(link->radv); +} + static Link *link_free(Link *link) { Address *address; @@ -686,25 +705,11 @@ static Link *link_free(Link *link) { address_free(address); } - sd_dhcp_server_unref(link->dhcp_server); - sd_dhcp_client_unref(link->dhcp_client); - sd_dhcp_lease_unref(link->dhcp_lease); - set_free(link->dhcp_routes); - link_lldp_emit_stop(link); - + link_free_engines(link); free(link->lease_file); - - sd_lldp_unref(link->lldp); free(link->lldp_file); - ndisc_flush(link); - - sd_ipv4ll_unref(link->ipv4ll); - sd_dhcp6_client_unref(link->dhcp6_client); - sd_ndisc_unref(link->ndisc); - sd_radv_unref(link->radv); - free(link->ifname); free(link->kind);