示例#1
0
sd_dhcp_lease *sd_dhcp_lease_unref(sd_dhcp_lease *lease) {
        if (lease && REFCNT_DEC(lease->n_ref) <= 0) {
                free(lease->hostname);
                free(lease->domainname);
                free(lease->dns);
                free(lease);
        }

        return NULL;
}
示例#2
0
sd_icmp6_nd *sd_icmp6_nd_unref(sd_icmp6_nd *nd) {
        if (nd && REFCNT_DEC(nd->n_ref) <= 0) {

                icmp6_nd_init(nd);
                sd_icmp6_nd_detach_event(nd);

                free(nd);
        }

        return NULL;
}
sd_pppoe *sd_pppoe_unref(sd_pppoe *ppp) {
        if (ppp && REFCNT_DEC(ppp->n_ref) <= 0) {
                pppoe_tags_clear(&ppp->tags);
                free(ppp->ifname);
                free(ppp->service_name);
                sd_pppoe_stop(ppp);
                sd_pppoe_detach_event(ppp);

                free(ppp);
        }

        return NULL;
}
示例#4
0
sd_dhcp_lease *sd_dhcp_lease_unref(sd_dhcp_lease *lease) {
        if (lease && REFCNT_DEC(lease->n_ref) <= 0) {
                free(lease->hostname);
                free(lease->domainname);
                free(lease->dns);
                free(lease->ntp);
                free(lease->static_route);
                free(lease->client_id);
                free(lease);
        }

        return NULL;
}
示例#5
0
sd_ipv4acd *sd_ipv4acd_unref(sd_ipv4acd *ll) {
        if (!ll || REFCNT_DEC(ll->n_ref) > 0)
                return NULL;

        ll->receive_message = sd_event_source_unref(ll->receive_message);
        ll->fd = safe_close(ll->fd);

        ll->timer = sd_event_source_unref(ll->timer);

        sd_ipv4acd_detach_event(ll);

        free(ll);

        return NULL;
}
示例#6
0
sd_netlink_message *sd_netlink_message_unref(sd_netlink_message *m) {
        if (m && REFCNT_DEC(m->n_ref) == 0) {
                unsigned i;

                free(m->hdr);

                for (i = 0; i <= m->n_containers; i++)
                        free(m->containers[i].attributes);

                sd_netlink_message_unref(m->next);

                free(m);
        }

        return NULL;
}
示例#7
0
sd_rtnl_message *sd_rtnl_message_unref(sd_rtnl_message *m) {
        if (m && REFCNT_DEC(m->n_ref) <= 0) {
                unsigned i;

                free(m->hdr);

                for (i = 0; i <= m->n_containers; i++)
                        free(m->rta_offset_tb[i]);

                sd_rtnl_message_unref(m->next);

                free(m);
        }

        return NULL;
}
示例#8
0
sd_ipv4ll *sd_ipv4ll_unref(sd_ipv4ll *ll) {
        if (ll && REFCNT_DEC(ll->n_ref) == 0) {
                ll->receive_message =
                        sd_event_source_unref(ll->receive_message);
                ll->fd = safe_close(ll->fd);

                ll->timer = sd_event_source_unref(ll->timer);

                sd_ipv4ll_detach_event(ll);

                free(ll->random_data);
                free(ll->random_data_state);
                free(ll);

                return NULL;
        }

        return ll;
}
示例#9
0
sd_dhcp_client *sd_dhcp_client_unref(sd_dhcp_client *client) {
        if (client && REFCNT_DEC(client->n_ref) <= 0) {
                log_dhcp_client(client, "UNREF");

                client_initialize(client);

                client->receive_message =
                        sd_event_source_unref(client->receive_message);

                sd_dhcp_client_detach_event(client);

                sd_dhcp_lease_unref(client->lease);

                free(client->req_opts);
                free(client);

                return NULL;
        }

        return client;
}
示例#10
0
sd_dhcp_lease *sd_dhcp_lease_unref(sd_dhcp_lease *lease) {
        if (lease && REFCNT_DEC(lease->n_ref) == 0) {
                while (lease->private_options) {
                        struct sd_dhcp_raw_option *option = lease->private_options;

                        LIST_REMOVE(options, lease->private_options, option);

                        free(option->data);
                        free(option);
                }
                free(lease->hostname);
                free(lease->domainname);
                free(lease->dns);
                free(lease->ntp);
                free(lease->static_route);
                free(lease->client_id);
                free(lease->vendor_specific);
                free(lease);
        }

        return NULL;
}