kernel/netgraph7: Replace usage of MALLOC/FREE with kmalloc/kfree here too.
[dragonfly.git] / sys / netgraph7 / ng_nat.c
index 78c626b..64856d5 100644 (file)
@@ -273,15 +273,15 @@ ng_nat_constructor(node_p node)
        priv_p priv;
 
        /* Initialize private descriptor. */
-       MALLOC(priv, priv_p, sizeof(*priv), M_NETGRAPH,
-               M_WAITOK | M_NULLOK | M_ZERO);
+       priv = kmalloc(sizeof(*priv), M_NETGRAPH,
+                      M_WAITOK | M_NULLOK | M_ZERO);
        if (priv == NULL)
                return (ENOMEM);
 
        /* Init aliasing engine. */
        priv->lib = LibAliasInit(NULL);
        if (priv->lib == NULL) {
-               FREE(priv, M_NETGRAPH);
+               kfree(priv, M_NETGRAPH);
                return (ENOMEM);
        }
 
@@ -409,7 +409,7 @@ ng_nat_rcvmsg(node_p node, item_p item, hook_p lasthook)
 
                        if (entry->lnk == NULL) {
                                error = ENOMEM;
-                               FREE(entry, M_NETGRAPH);
+                               kfree(entry, M_NETGRAPH);
                                break;
                        }
 
@@ -465,7 +465,7 @@ ng_nat_rcvmsg(node_p node, item_p item, hook_p lasthook)
 
                        if (entry->lnk == NULL) {
                                error = ENOMEM;
-                               FREE(entry, M_NETGRAPH);
+                               kfree(entry, M_NETGRAPH);
                                break;
                        }
 
@@ -518,7 +518,7 @@ ng_nat_rcvmsg(node_p node, item_p item, hook_p lasthook)
 
                        if (entry->lnk == NULL) {
                                error = ENOMEM;
-                               FREE(entry, M_NETGRAPH);
+                               kfree(entry, M_NETGRAPH);
                                break;
                        }
 
@@ -584,7 +584,7 @@ ng_nat_rcvmsg(node_p node, item_p item, hook_p lasthook)
                        /* Delete entry from our internal list. */
                        priv->rdrcount--;
                        STAILQ_REMOVE(&priv->redirhead, entry, ng_nat_rdr_lst, entries);
-                       FREE(entry, M_NETGRAPH);
+                       kfree(entry, M_NETGRAPH);
                    }
                        break;
                case NGM_NAT_ADD_SERVER:
@@ -786,12 +786,12 @@ ng_nat_shutdown(node_p node)
        while (!STAILQ_EMPTY(&priv->redirhead)) {
                struct ng_nat_rdr_lst *entry = STAILQ_FIRST(&priv->redirhead);
                STAILQ_REMOVE_HEAD(&priv->redirhead, entries);
-               FREE(entry, M_NETGRAPH);
+               kfree(entry, M_NETGRAPH);
        };
 
        /* Final free. */
        LibAliasUninit(priv->lib);
-       FREE(priv, M_NETGRAPH);
+       kfree(priv, M_NETGRAPH);
 
        return (0);
 }