summaryrefslogtreecommitdiff
path: root/lib/isc/taskpool.c
diff options
context:
space:
mode:
authorErwin Lansing <erwin@FreeBSD.org>2013-07-24 07:12:55 +0000
committerErwin Lansing <erwin@FreeBSD.org>2013-07-24 07:12:55 +0000
commit6f34f6a389ca8199c4b20c17f62d7d924baef7fb (patch)
treee392027bf54f7a1fd2a6f3a16ecb4487844b44e9 /lib/isc/taskpool.c
parent650b026006ec14e630f658a0f877099ec38b660b (diff)
Notes
Diffstat (limited to 'lib/isc/taskpool.c')
-rw-r--r--lib/isc/taskpool.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/isc/taskpool.c b/lib/isc/taskpool.c
index 936732c0e955..7324cfa379d0 100644
--- a/lib/isc/taskpool.c
+++ b/lib/isc/taskpool.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004, 2005, 2007, 2011, 2012 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004, 2005, 2007, 2011-2013 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 1999-2001 Internet Software Consortium.
*
* Permission to use, copy, modify, and/or distribute this software for any
@@ -52,13 +52,15 @@ alloc_pool(isc_taskmgr_t *tmgr, isc_mem_t *mctx, unsigned int ntasks,
pool = isc_mem_get(mctx, sizeof(*pool));
if (pool == NULL)
return (ISC_R_NOMEMORY);
- pool->mctx = mctx;
+
+ pool->mctx = NULL;
+ isc_mem_attach(mctx, &pool->mctx);
pool->ntasks = ntasks;
pool->quantum = quantum;
pool->tmgr = tmgr;
pool->tasks = isc_mem_get(mctx, ntasks * sizeof(isc_task_t *));
if (pool->tasks == NULL) {
- isc_mem_put(mctx, pool, sizeof(*pool));
+ isc_mem_putanddetach(&pool->mctx, pool, sizeof(*pool));
return (ISC_R_NOMEMORY);
}
for (i = 0; i < ntasks; i++)
@@ -169,7 +171,7 @@ isc_taskpool_destroy(isc_taskpool_t **poolp) {
}
isc_mem_put(pool->mctx, pool->tasks,
pool->ntasks * sizeof(isc_task_t *));
- isc_mem_put(pool->mctx, pool, sizeof(*pool));
+ isc_mem_putanddetach(&pool->mctx, pool, sizeof(*pool));
*poolp = NULL;
}