Logo Search packages:      
Sourcecode: libnl2 version File versions  Download package

void nlmsg_free ( struct nl_msg *  msg  ) 

Release a reference from an netlink message

  • msg message to release reference from
Frees memory after the last reference has been released.

Definition at line 666 of file msg.c.

Referenced by flnl_lookup(), flnl_lookup_build_request(), nfnlmsg_alloc_simple(), nl_msg_dump(), nl_send_simple(), nlmsg_convert(), rtnl_addr_add(), rtnl_addr_delete(), rtnl_class_add(), rtnl_class_delete(), rtnl_cls_add(), rtnl_cls_change(), rtnl_cls_delete(), rtnl_link_build_change_request(), rtnl_link_change(), rtnl_neigh_add(), rtnl_neigh_delete(), rtnl_neightbl_build_change_request(), rtnl_neightbl_change(), rtnl_qdisc_add(), rtnl_qdisc_build_delete_request(), rtnl_qdisc_change(), rtnl_qdisc_delete(), rtnl_rule_add(), and rtnl_rule_delete().

{
      if (!msg)
            return;

      msg->nm_refcnt--;
      NL_DBG(4, "Returned message reference %p, %d remaining\n",
             msg, msg->nm_refcnt);

      if (msg->nm_refcnt < 0)
            BUG();

      if (msg->nm_refcnt <= 0) {
            free(msg->nm_nlh);
            free(msg);
            NL_DBG(2, "msg %p: Freed\n", msg);
      }
}


Generated by  Doxygen 1.6.0   Back to index