event = isc_event_allocate(mctx, query, ISC_TIMEREVENT_IDLE,
connect_timeout, query,
sizeof(isc_event_t));
- if (event == NULL) {
- fatal("isc_event_allocate: %s",
- isc_result_totext(ISC_R_NOMEMORY));
- }
isc_task_send(global_task, &event);
/*
sevent = (sevent_t *)
isc_event_allocate(mctx, task, SIGNER_EVENT_WORK,
sign, NULL, sizeof(sevent_t));
- if (sevent == NULL)
- fatal("failed to allocate event\n");
sevent->node = node;
sevent->fname = fname;
wevent = (sevent_t *)
isc_event_allocate(mctx, task, SIGNER_EVENT_WRITE,
writenode, NULL, sizeof(sevent_t));
- if (wevent == NULL)
- fatal("failed to allocate event\n");
wevent->node = node;
wevent->fname = fname;
isc_task_send(master, ISC_EVENT_PTR(&wevent));
event = (catz_chgzone_event_t *) isc_event_allocate(view->mctx, origin,
type, action, NULL,
sizeof(*event));
- if (event == NULL)
- return (ISC_R_NOMEMORY);
event->cbd = (catz_cb_data_t *) udata;
event->entry = NULL;
dns_zone_attach(zone, &dz->zone);
dzevent = isc_event_allocate(named_g_mctx, server, NAMED_EVENT_DELZONE,
rmzone, dz, sizeof(isc_event_t));
- if (dzevent == NULL)
- CHECK(ISC_R_NOMEMORY);
dns_zone_gettask(zone, &task);
isc_task_send(task, &dzevent);
SYNCPTR_WRITE_EVENT,
syncptr_write, NULL,
sizeof(syncptrevent_t));
- if (pevent == NULL) {
- result = ISC_R_NOMEMORY;
- goto cleanup;
- }
isc_buffer_init(&pevent->b, pevent->buf, sizeof(pevent->buf));
dns_fixedname_init(&pevent->ptr_target_name);
DNS_EVENT_CACHECLEAN,
incremental_cleaning_action,
cleaner, sizeof(isc_event_t));
- if (cleaner->resched_event == NULL) {
- result = ISC_R_NOMEMORY;
- goto cleanup;
- }
cleaner->overmem_event =
isc_event_allocate(cache->mctx, cleaner,
DNS_EVENT_CACHEOVERMEM,
overmem_cleaning_action,
cleaner, sizeof(isc_event_t));
- if (cleaner->overmem_event == NULL) {
- result = ISC_R_NOMEMORY;
- goto cleanup;
- }
}
return (ISC_R_SUCCESS);
event = (dns_clientresevent_t *)
isc_event_allocate(mctx, tclone, DNS_EVENT_CLIENTRESDONE,
action, arg, sizeof(*event));
- if (event == NULL) {
- result = ISC_R_NOMEMORY;
- goto cleanup;
- }
event->result = DNS_R_SERVFAIL;
ISC_LIST_INIT(event->answerlist);
isc_event_allocate(client->mctx, tclone,
DNS_EVENT_CLIENTREQDONE,
action, arg, sizeof(*event));
- if (event == NULL) {
- result = ISC_R_NOMEMORY;
- goto cleanup;
- }
ctx = isc_mem_get(client->mctx, sizeof(*ctx));
if (ctx == NULL)
uctx->event = (dns_clientupdateevent_t *)
isc_event_allocate(client->mctx, tclone, DNS_EVENT_UPDATEDONE,
action, arg, sizeof(*uctx->event));
- if (uctx->event == NULL)
- goto fail;
if (zonename != NULL) {
uctx->zonename = dns_fixedname_name(&uctx->zonefname);
result = dns_name_copy(zonename, uctx->zonename, NULL);
event = isc_event_allocate(client->mctx, dns_client_startupdate,
DNS_EVENT_STARTUPDATE, startupdate,
uctx, sizeof(*event));
- if (event != NULL) {
- result = ISC_R_SUCCESS;
- isc_task_send(task, &event);
- } else
- result = ISC_R_NOMEMORY;
+ result = ISC_R_SUCCESS;
+ isc_task_send(task, &event);
}
if (result == ISC_R_SUCCESS)
return (result);
DNS_EVENT_DISPATCHCONTROL,
destroy_disp, disp,
sizeof(isc_event_t));
- if (disp->ctlevent == NULL) {
- result = ISC_R_NOMEMORY;
- goto kill_task;
- }
isc_task_setname(disp->task[0], "tcpdispatch", disp);
return (ISC_R_SUCCESS);
- /*
- * Error returns.
- */
- kill_task:
- isc_task_detach(&disp->task[0]);
kill_socket:
isc_socket_detach(&disp->socket);
deallocate_dispatch:
DNS_EVENT_DISPATCHCONTROL,
destroy_disp, disp,
sizeof(isc_event_t));
- if (disp->ctlevent == NULL) {
- result = ISC_R_NOMEMORY;
- goto kill_task;
- }
disp->sepool = NULL;
if (isc_mempool_create(mgr->mctx, sizeof(isc_socketevent_t),
*/
kill_ctlevent:
isc_event_free(&disp->ctlevent);
- kill_task:
for (i = 0; i < disp->ntasks; i++) {
isc_task_detach(&disp->task[i]);
}
isc_event_allocate(disp->mgr->mctx, NULL,
DNS_EVENT_IMPORTRECVDONE, udp_shrecv,
disp, sizeof(isc_socketevent_t));
- if (newsevent == NULL)
- return;
buf = allocate_udp_buffer(disp);
if (buf == NULL) {
*/
event = isc_event_allocate(env->mctx, NULL, DNS_EVENT_FREESTORAGE,
perform_reopen, env, sizeof(*event));
- if (event == NULL) {
- goto unlock_and_return;
- }
isc_task_attach(env->reopen_task, &reopen_task);
isc_task_send(reopen_task, &event);
env->reopen_queued = true;
ievent = isc_event_allocate(mctx, lookup, DNS_EVENT_LOOKUPDONE,
action, arg, sizeof(*lookup->event));
- if (ievent == NULL) {
- result = ISC_R_NOMEMORY;
- goto cleanup_lookup;
- }
lookup->event = (dns_lookupevent_t *)ievent;
lookup->event->ev_destroy = levent_destroy;
lookup->event->ev_destroy_arg = mctx;
isc_task_detach(&lookup->task);
- cleanup_lookup:
isc_mem_putanddetach(&mctx, lookup, sizeof(*lookup));
return (result);
event = isc_event_allocate(lctx->mctx, NULL,
DNS_EVENT_MASTERQUANTUM,
load_quantum, lctx, sizeof(*event));
- if (event == NULL)
- return (ISC_R_NOMEMORY);
isc_task_send(lctx->task, &event);
return (ISC_R_SUCCESS);
}
event = isc_event_allocate(dctx->mctx, NULL, DNS_EVENT_DUMPQUANTUM,
dump_quantum, dctx, sizeof(*event));
- if (event == NULL)
- return (ISC_R_NOMEMORY);
isc_task_send(dctx->task, &event);
return (ISC_R_SUCCESS);
}
free_rbtdb_callback,
rbtdb,
sizeof(isc_event_t));
- if (event == NULL)
- continue;
isc_task_send(rbtdb->task, &event);
return;
}
DNS_EVENT_RBTPRUNE,
prune_tree, node,
sizeof(isc_event_t));
- if (ev != NULL) {
- new_reference(rbtdb, node);
- db = NULL;
- attach((dns_db_t *)rbtdb, &db);
- ev->ev_sender = db;
- isc_task_send(rbtdb->task, &ev);
- } else {
- ISC_LIST_APPEND(rbtdb->deadnodes[bucketnum],
- node, deadlink);
- }
+ new_reference(rbtdb, node);
+ db = NULL;
+ attach((dns_db_t *)rbtdb, &db);
+ ev->ev_sender = db;
+ isc_task_send(rbtdb->task, &ev);
} else {
delete_node(rbtdb, node);
}
DNS_EVENT_RBTPRUNE,
prune_tree, node,
sizeof(isc_event_t));
- if (ev != NULL) {
- new_reference(rbtdb, node);
- db = NULL;
- attach((dns_db_t *)rbtdb, &db);
- ev->ev_sender = db;
- isc_task_send(rbtdb->task, &ev);
- no_reference = false;
- } else {
- /*
- * XXX: this is a weird situation. We could
- * ignore this error case, but then the stale
- * node will unlikely be purged except via a
- * rare condition such as manual cleanup. So
- * we queue it in the deadnodes list, hoping
- * the memory shortage is temporary and the node
- * will be deleted later.
- */
- isc_log_write(dns_lctx,
- DNS_LOGCATEGORY_DATABASE,
- DNS_LOGMODULE_CACHE,
- ISC_LOG_INFO,
- "decrement_reference: failed to "
- "allocate pruning event");
- INSIST(node->data == NULL);
- INSIST(!ISC_LINK_LINKED(node, deadlink));
- ISC_LIST_APPEND(rbtdb->deadnodes[bucket], node,
- deadlink);
- }
+ new_reference(rbtdb, node);
+ db = NULL;
+ attach((dns_db_t *)rbtdb, &db);
+ ev->ev_sender = db;
+ isc_task_send(rbtdb->task, &ev);
+ no_reference = false;
} else {
delete_node(rbtdb, node);
}
request->event = (dns_requestevent_t *)
isc_event_allocate(mctx, task, DNS_EVENT_REQUESTDONE,
action, arg, sizeof(dns_requestevent_t));
- if (request->event == NULL) {
- result = ISC_R_NOMEMORY;
- goto cleanup;
- }
isc_task_attach(task, &tclone);
request->event->ev_sender = task;
request->event->request = request;
request->event = (dns_requestevent_t *)
isc_event_allocate(mctx, task, DNS_EVENT_REQUESTDONE,
action, arg, sizeof(dns_requestevent_t));
- if (request->event == NULL) {
- result = ISC_R_NOMEMORY;
- goto cleanup;
- }
isc_task_attach(task, &tclone);
request->event->ev_sender = task;
request->event->request = request;
event = (dns_fetchevent_t *)
isc_event_allocate(fctx->res->mctx, tclone, DNS_EVENT_FETCHDONE,
action, arg, sizeof(*event));
- if (event == NULL) {
- isc_task_detach(&tclone);
- return (ISC_R_NOMEMORY);
- }
event->result = DNS_R_SERVFAIL;
event->qtype = fctx->type;
event->db = NULL;
DNS_EVENT_VALIDATORSTART,
validator_start, NULL,
sizeof(dns_validatorevent_t));
- if (event == NULL) {
- result = ISC_R_NOMEMORY;
- goto cleanup_val;
- }
isc_task_attach(task, &tclone);
event->validator = val;
event->result = ISC_R_FAILURE;
isc_task_detach(&tclone);
isc_event_free(ISC_EVENT_PTR(&event));
- cleanup_val:
dns_view_weakdetach(&val->view);
isc_mem_put(view->mctx, val, sizeof(*val));
{
isc_event_t *e;
dns_asyncload_t *asl = NULL;
- isc_result_t result = ISC_R_SUCCESS;
REQUIRE(DNS_ZONE_VALID(zone));
- if (zone->zmgr == NULL)
+ if (zone->zmgr == NULL) {
return (ISC_R_FAILURE);
+ }
/* If we already have a load pending, stop now */
LOCK_ZONE(zone);
DNS_EVENT_ZONELOAD,
zone_asyncload, asl,
sizeof(isc_event_t));
- if (e == NULL)
- CHECK(ISC_R_NOMEMORY);
zone_iattach(zone, &asl->zone);
DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_LOADPENDING);
UNLOCK_ZONE(zone);
return (ISC_R_SUCCESS);
-
- failure:
- if (asl != NULL)
- isc_mem_put(zone->mctx, asl, sizeof (*asl));
- UNLOCK_ZONE(zone);
- return (result);
}
bool
INSIST(notify->event == NULL);
e = isc_event_allocate(notify->mctx, NULL, DNS_EVENT_NOTIFYSENDTOADDR,
notify_send_toaddr, notify, sizeof(isc_event_t));
- if (e == NULL)
- return (ISC_R_NOMEMORY);
if (startup)
notify->event = e;
e->ev_arg = notify;
e = isc_event_allocate(zone->mctx, NULL, DNS_EVENT_ZONE,
soa_query, zone, sizeof(isc_event_t));
- if (e == NULL) {
- cancel_refresh(zone);
- return;
- }
/*
* Attach so that we won't clean up
DNS_EVENT_ZONESECURESERIAL,
receive_secure_serial, zone->secure,
sizeof(struct secure_event));
- if (e == NULL)
- return (ISC_R_NOMEMORY);
((struct secure_event *)e)->serial = serial;
INSIST(LOCKED_ZONE(zone->secure));
zone_iattach(zone->secure, &dummy);
DNS_EVENT_ZONESECUREDB,
receive_secure_db, zone->secure,
sizeof(struct secure_event));
- if (e == NULL)
- return (ISC_R_NOMEMORY);
dns_db_attach(db, &dummy);
((struct secure_event *)e)->db = dummy;
INSIST(LOCKED_ZONE(zone->secure));
*/
e = isc_event_allocate(zmgr->mctx, zmgr, DNS_EVENT_ZONESTARTXFRIN,
got_transfer_quota, zone, sizeof(isc_event_t));
- if (e == NULL)
- return (ISC_R_NOMEMORY);
LOCK_ZONE(zone);
INSIST(zone->statelist == &zmgr->waiting_for_xfrin);
io->event = isc_event_allocate(zmgr->mctx, task, DNS_EVENT_IOREADY,
action, arg, sizeof(*io->event));
- if (io->event == NULL) {
- isc_mem_put(zmgr->mctx, io, sizeof(*io));
- return (ISC_R_NOMEMORY);
- }
io->zmgr = zmgr;
io->high = high;
e = isc_event_allocate(zone->mctx, zone, DNS_EVENT_KEYDONE, keydone,
zone, sizeof(struct keydone));
- if (e == NULL) {
- result = ISC_R_NOMEMORY;
- goto failure;
- }
kd = (struct keydone *) e;
if (strcasecmp(keystr, "all") == 0) {
e = isc_event_allocate(zone->mctx, zone, DNS_EVENT_SETNSEC3PARAM,
setnsec3param, zone, sizeof(struct np3event));
- if (e == NULL) {
- result = ISC_R_NOMEMORY;
- goto failure;
- }
npe = (struct np3event *) e;
np = &npe->params;
e = isc_event_allocate(zone->mctx, zone, DNS_EVENT_SETSERIAL,
setserial, zone, sizeof(struct ssevent));
- if (e == NULL) {
- result = ISC_R_NOMEMORY;
- goto failure;
- }
sse = (struct ssevent *)e;
sse->serial = serial;
isc_task_attach(task, &cloned_task);
event = isc_event_allocate(mctx, cloned_task, ISC_APPEVENT_SHUTDOWN,
action, arg, sizeof(*event));
- if (event == NULL) {
- isc_task_detach(&cloned_task);
- return (ISC_R_NOMEMORY);
- }
LOCK(&ctx->lock);
ISC_LINK_INIT(event, ev_link);
action,
arg,
sizeof(*event));
- if (event == NULL)
- return (ISC_R_NOMEMORY);
LOCK(&task->lock);
if (TASK_SHUTTINGDOWN(task)) {
eventtype, action, arg,
sizeof(*ev));
- if (ev == NULL)
- return (NULL);
-
ev->result = ISC_R_UNSET;
ISC_LINK_INIT(ev, ev_link);
ev->region.base = NULL;
dev = (isc_socket_newconnev_t *)
isc_event_allocate(manager->mctx, task, ISC_SOCKEVENT_NEWCONN,
action, arg, sizeof(*dev));
- if (dev == NULL) {
- UNLOCK(&sock->lock);
- return (ISC_R_NOMEMORY);
- }
ISC_LINK_INIT(dev, ev_link);
result = allocate_socket(manager, sock->type, &nsock);
ISC_SOCKEVENT_CONNECT,
action, arg,
sizeof(*dev));
- if (dev == NULL) {
- UNLOCK(&sock->lock);
- return (ISC_R_NOMEMORY);
- }
ISC_LINK_INIT(dev, ev_link);
if (sock->connecting) {
ev = (isc_socketevent_t *)isc_event_allocate(mctx, sock, eventtype,
action, arg,
sizeof(*ev));
- if (ev == NULL)
- return (NULL);
ev->result = ISC_R_IOERROR; // XXXMLG temporary change to detect failure to set
ISC_LINK_INIT(ev, ev_link);
adev = (isc_socket_newconnev_t *)
isc_event_allocate(manager->mctx, task, ISC_SOCKEVENT_NEWCONN,
action, arg, sizeof(*adev));
- if (adev == NULL) {
- UNLOCK(&sock->lock);
- return (ISC_R_NOMEMORY);
- }
ISC_LINK_INIT(adev, ev_link);
result = allocate_socket(manager, sock->type, &nsock);
ISC_SOCKEVENT_CONNECT,
action, arg,
sizeof(*cdev));
- if (cdev == NULL) {
- UNLOCK(&sock->lock);
- return (ISC_R_NOMEMORY);
- }
ISC_LINK_INIT(cdev, ev_link);
if (sock->connected) {
event = (update_event_t *)
isc_event_allocate(client->mctx, client, DNS_EVENT_UPDATE,
update_action, NULL, sizeof(*event));
- if (event == NULL)
- FAIL(ISC_R_NOMEMORY);
event->zone = zone;
event->result = ISC_R_SUCCESS;
dns_zone_gettask(zone, &zonetask);
isc_task_send(zonetask, ISC_EVENT_PTR(&event));
- failure:
- if (event != NULL)
- isc_event_free(ISC_EVENT_PTR(&event));
return (result);
}
event = (update_event_t *)
isc_event_allocate(client->mctx, client, DNS_EVENT_UPDATE,
forward_action, NULL, sizeof(*event));
- if (event == NULL)
- FAIL(ISC_R_NOMEMORY);
event->zone = zone;
event->result = ISC_R_SUCCESS;