aboutsummaryrefslogtreecommitdiff
path: root/sys/netgraph/ng_base.c
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2005-09-08 14:32:19 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2005-09-08 14:32:19 +0000
commit1bf8e0faeda238e2a2d43e113e11021f27fed3c6 (patch)
tree8732d2162d2d127be0aa509eeda3099dab355bf8 /sys/netgraph/ng_base.c
parent83beeed9936a415e6894514ef791dee22c0e5d72 (diff)
Notes
Diffstat (limited to 'sys/netgraph/ng_base.c')
-rw-r--r--sys/netgraph/ng_base.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/netgraph/ng_base.c b/sys/netgraph/ng_base.c
index 0014f5ffc22f4..d37ae21e92c56 100644
--- a/sys/netgraph/ng_base.c
+++ b/sys/netgraph/ng_base.c
@@ -3538,7 +3538,7 @@ int
ng_callout(struct callout *c, node_p node, hook_p hook, int ticks,
ng_item_fn *fn, void * arg1, int arg2)
{
- item_p item;
+ item_p item, oitem;
if ((item = ng_getqblk(NG_NOFLAGS)) == NULL)
return (ENOMEM);
@@ -3553,7 +3553,10 @@ ng_callout(struct callout *c, node_p node, hook_p hook, int ticks,
NGI_FN(item) = fn;
NGI_ARG1(item) = arg1;
NGI_ARG2(item) = arg2;
- callout_reset(c, ticks, &ng_callout_trampoline, item);
+ oitem = c->c_arg;
+ if (callout_reset(c, ticks, &ng_callout_trampoline, item) == 1 &&
+ oitem != NULL)
+ NG_FREE_ITEM(oitem);
return (0);
}
@@ -3579,6 +3582,7 @@ ng_uncallout(struct callout *c, node_p node)
*/
NG_FREE_ITEM(item);
}
+ c->c_arg = NULL;
return (rval);
}