mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-11 07:00:00 -04:00
isc_mem_get cannot fail
This commit is contained in:
parent
d6de520bd1
commit
bb65e57297
1 changed files with 9 additions and 24 deletions
|
|
@ -1340,13 +1340,7 @@ dns_client_startresolve(dns_client_t *client, const dns_name_t *name,
|
|||
ISC_LIST_INIT(event->answerlist);
|
||||
|
||||
rctx = isc_mem_get(mctx, sizeof(*rctx));
|
||||
if (rctx == NULL)
|
||||
result = ISC_R_NOMEMORY;
|
||||
else {
|
||||
isc_mutex_init(&rctx->lock);
|
||||
}
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup;
|
||||
isc_mutex_init(&rctx->lock);
|
||||
|
||||
result = getrdataset(mctx, &rdataset);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
|
|
@ -1748,13 +1742,7 @@ dns_client_startrequest(dns_client_t *client, dns_message_t *qmessage,
|
|||
action, arg, sizeof(*event));
|
||||
|
||||
ctx = isc_mem_get(client->mctx, sizeof(*ctx));
|
||||
if (ctx == NULL)
|
||||
result = ISC_R_NOMEMORY;
|
||||
else {
|
||||
isc_mutex_init(&ctx->lock);
|
||||
}
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup;
|
||||
isc_mutex_init(&ctx->lock);
|
||||
|
||||
ctx->client = client;
|
||||
ISC_LINK_INIT(ctx, link);
|
||||
|
|
@ -1787,16 +1775,13 @@ dns_client_startrequest(dns_client_t *client, dns_message_t *qmessage,
|
|||
|
||||
isc_refcount_decrement(&client->references);
|
||||
|
||||
cleanup:
|
||||
if (ctx != NULL) {
|
||||
LOCK(&client->lock);
|
||||
ISC_LIST_UNLINK(client->reqctxs, ctx, link);
|
||||
UNLOCK(&client->lock);
|
||||
isc_mutex_destroy(&ctx->lock);
|
||||
isc_mem_put(client->mctx, ctx, sizeof(*ctx));
|
||||
}
|
||||
if (event != NULL)
|
||||
isc_event_free(ISC_EVENT_PTR(&event));
|
||||
LOCK(&client->lock);
|
||||
ISC_LIST_UNLINK(client->reqctxs, ctx, link);
|
||||
UNLOCK(&client->lock);
|
||||
isc_mutex_destroy(&ctx->lock);
|
||||
isc_mem_put(client->mctx, ctx, sizeof(*ctx));
|
||||
|
||||
isc_event_free(ISC_EVENT_PTR(&event));
|
||||
isc_task_detach(&tclone);
|
||||
dns_view_detach(&view);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue