+3520. [bug] 'mctx' was not being referenced counted in some places
+ where it should have been. [RT #32794]
+
3519. [func] Full replay protection via four-way handshake is
now mandatory for rndc clients. Very old versions
of rndc will no longer work. [RT #32798]
if (listener->acl != NULL)
dns_acl_detach(&listener->acl);
- isc_mem_put(listener->mctx, listener, sizeof(*listener));
+ isc_mem_putanddetach(&listener->mctx, listener, sizeof(*listener));
}
static void
result = ISC_R_NOMEMORY;
if (result == ISC_R_SUCCESS) {
+ listener->mctx = NULL;
+ isc_mem_attach(mctx, &listener->mctx);
listener->controls = cp;
- listener->mctx = mctx;
listener->task = cp->server->task;
listener->address = *addr;
listener->sock = NULL;
if (mgr == NULL)
return (ISC_R_NOMEMORY);
+ mgr->mctx = NULL;
+ isc_mem_attach(mctx, &mgr->mctx);
+
result = isc_mutex_init(&mgr->lock);
if (result != ISC_R_SUCCESS)
goto cleanup_mem;
- mgr->mctx = mctx;
mgr->taskmgr = taskmgr;
mgr->socketmgr = socketmgr;
mgr->dispatchmgr = dispatchmgr;
ns_listenlist_detach(&mgr->listenon4);
ns_listenlist_detach(&mgr->listenon6);
cleanup_mem:
- isc_mem_put(mctx, mgr, sizeof(*mgr));
+ isc_mem_putanddetach(&mgr->mctx, mgr, sizeof(*mgr));
return (result);
}
clearlistenon(mgr);
DESTROYLOCK(&mgr->lock);
mgr->magic = 0;
- isc_mem_put(mgr->mctx, mgr, sizeof(*mgr));
+ isc_mem_putanddetach(&mgr->mctx, mgr, sizeof(*mgr));
}
dns_aclenv_t *
return (result);
}
table->references = 1;
- table->mctx = mctx;
+ table->mctx = NULL;
+ isc_mem_attach(mctx, &table->mctx);
ISC_LIST_INIT(table->rules);
table->magic = SSUTABLEMAGIC;
*tablep = table;
}
DESTROYLOCK(&table->lock);
table->magic = 0;
- isc_mem_put(mctx, table, sizeof(dns_ssutable_t));
+ isc_mem_putanddetach(&table->mctx, table, sizeof(dns_ssutable_t));
}
void
view = isc_mem_get(mctx, sizeof(*view));
if (view == NULL)
return (ISC_R_NOMEMORY);
+
+ view->mctx = NULL;
+ isc_mem_attach(mctx, &view->mctx);
view->name = isc_mem_strdup(mctx, name);
if (view->name == NULL) {
result = ISC_R_NOMEMORY;
view->resolver = NULL;
view->adb = NULL;
view->requestmgr = NULL;
- view->mctx = mctx;
view->rdclass = rdclass;
view->frozen = ISC_FALSE;
view->task = NULL;
isc_mem_free(mctx, view->name);
cleanup_view:
- isc_mem_put(mctx, view, sizeof(*view));
+ isc_mem_putanddetach(&view->mctx, view, sizeof(*view));
return (result);
}
DESTROYLOCK(&view->lock);
isc_refcount_destroy(&view->references);
isc_mem_free(view->mctx, view->name);
- isc_mem_put(view->mctx, view, sizeof(*view));
+ isc_mem_putanddetach(&view->mctx, view, sizeof(*view));
}
/*
xfr = isc_mem_get(mctx, sizeof(*xfr));
if (xfr == NULL)
return (ISC_R_NOMEMORY);
- xfr->mctx = mctx;
+ xfr->mctx = NULL;
+ isc_mem_attach(mctx, &xfr->mctx);
xfr->refcount = 0;
xfr->zone = NULL;
dns_zone_iattach(zone, &xfr->zone);
dns_db_detach(&xfr->db);
isc_task_detach(&xfr->task);
dns_zone_idetach(&xfr->zone);
- isc_mem_put(mctx, xfr, sizeof(*xfr));
+ isc_mem_putanddetach(&xfr->mctx, xfr, sizeof(*xfr));
return (result);
}
if (xfr->zone != NULL)
dns_zone_idetach(&xfr->zone);
- isc_mem_put(xfr->mctx, xfr, sizeof(*xfr));
+ isc_mem_putanddetach(&xfr->mctx, xfr, sizeof(*xfr));
}
/*
symtab = (isc_symtab_t *)isc_mem_get(mctx, sizeof(*symtab));
if (symtab == NULL)
return (ISC_R_NOMEMORY);
+
+ symtab->mctx = NULL;
+ isc_mem_attach(mctx, &symtab->mctx);
symtab->table = (eltlist_t *)isc_mem_get(mctx,
size * sizeof(eltlist_t));
if (symtab->table == NULL) {
- isc_mem_put(mctx, symtab, sizeof(*symtab));
+ isc_mem_putanddetach(&symtab->mctx, symtab, sizeof(*symtab));
return (ISC_R_NOMEMORY);
}
for (i = 0; i < size; i++)
INIT_LIST(symtab->table[i]);
- symtab->mctx = mctx;
symtab->size = size;
symtab->count = 0;
symtab->maxload = size * 3 / 4;
isc_mem_put(symtab->mctx, symtab->table,
symtab->size * sizeof(eltlist_t));
symtab->magic = 0;
- isc_mem_put(symtab->mctx, symtab, sizeof(*symtab));
+ isc_mem_putanddetach(&symtab->mctx, symtab, sizeof(*symtab));
*symtabp = NULL;
}
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++)
}
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;
}
if (pctx == NULL)
return (ISC_R_NOMEMORY);
+ pctx->mctx = NULL;
+ isc_mem_attach(mctx, &pctx->mctx);
+
result = isc_refcount_init(&pctx->references, 1);
if (result != ISC_R_SUCCESS) {
- isc_mem_put(mctx, pctx, sizeof(*pctx));
+ isc_mem_putanddetach(&pctx->mctx, pctx, sizeof(*pctx));
return (result);
}
- pctx->mctx = mctx;
pctx->lctx = lctx;
pctx->lexer = NULL;
pctx->seen_eof = ISC_FALSE;
isc_lex_destroy(&pctx->lexer);
CLEANUP_OBJ(pctx->open_files);
CLEANUP_OBJ(pctx->closed_files);
- isc_mem_put(mctx, pctx, sizeof(*pctx));
+ isc_mem_putanddetach(&pctx->mctx, pctx, sizeof(*pctx));
return (result);
}
*/
CLEANUP_OBJ(pctx->open_files);
CLEANUP_OBJ(pctx->closed_files);
- isc_mem_put(pctx->mctx, pctx, sizeof(*pctx));
+ isc_mem_putanddetach(&pctx->mctx, pctx, sizeof(*pctx));
}
*pctxp = NULL;
}