Commit c73e5866 authored by Ondřej Surý's avatar Ondřej Surý

Refactor the isc_buffer_allocate() usage using the semantic patch

The isc_buffer_allocate() function now cannot fail with ISC_R_MEMORY.
This commit removes all the checks on the return code using the semantic
patch from previous commit, as isc_buffer_allocate() now returns void.
parent d5f682a0
......@@ -568,8 +568,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf,
if (!query->lookup->comments)
flags |= DNS_MESSAGETEXTFLAG_NOCOMMENTS;
result = isc_buffer_allocate(mctx, &buf, len);
check_result(result, "isc_buffer_allocate");
isc_buffer_allocate(mctx, &buf, len);
if (yaml) {
enum { Q = 0x1, R = 0x2 }; /* Q:query; R:ecursive */
......@@ -742,11 +741,8 @@ repopulate_buffer:
buftoosmall:
len += OUTPUTBUF;
isc_buffer_free(&buf);
result = isc_buffer_allocate(mctx, &buf, len);
if (result == ISC_R_SUCCESS)
goto repopulate_buffer;
else
goto cleanup;
isc_buffer_allocate(mctx, &buf, len);
goto repopulate_buffer;
}
check_result(result,
"dns_message_pseudosectiontotext");
......@@ -827,7 +823,6 @@ buftoosmall:
(char *)isc_buffer_base(buf));
isc_buffer_free(&buf);
cleanup:
if (style != NULL)
dns_master_styledestroy(&style, mctx);
return (result);
......
......@@ -883,10 +883,8 @@ setup_text_key(void) {
unsigned char *secretstore;
debug("setup_text_key()");
result = isc_buffer_allocate(mctx, &namebuf, MXNAME);
check_result(result, "isc_buffer_allocate");
isc_buffer_allocate(mctx, &namebuf, MXNAME);
dns_name_init(&keyname, NULL);
check_result(result, "dns_name_init");
isc_buffer_putstr(namebuf, keynametext);
secretsize = (unsigned int) strlen(keysecret) * 3 / 4;
secretstore = isc_mem_allocate(mctx, secretsize);
......
......@@ -199,8 +199,7 @@ say_message(dns_name_t *name, const char *msg, dns_rdata_t *rdata,
dns_name_format(name, namestr, sizeof(namestr));
retry:
result = isc_buffer_allocate(mctx, &b, bufsize);
check_result(result, "isc_buffer_allocate");
isc_buffer_allocate(mctx, &b, bufsize);
result = dns_rdata_totext(rdata, NULL, b);
if (result == ISC_R_NOSPACE) {
isc_buffer_free(&b);
......
......@@ -221,9 +221,7 @@ printrdata(dns_rdata_t *rdata) {
printf("rdata_%d = ", rdata->type);
while (!done) {
result = isc_buffer_allocate(mctx, &b, size);
if (result != ISC_R_SUCCESS)
check_result(result, "isc_buffer_allocate");
isc_buffer_allocate(mctx, &b, size);
result = dns_rdata_totext(rdata, NULL, b);
if (result == ISC_R_SUCCESS) {
printf("%.*s\n", (int)isc_buffer_usedlength(b),
......
......@@ -370,8 +370,7 @@ formatset(dns_rdataset_t *rdataset) {
mctx);
check_result(result, "dns_master_stylecreate2 failed");
result = isc_buffer_allocate(mctx, &buf, MAX_CDS_RDATA_TEXT_SIZE);
check_result(result, "printing DS records");
isc_buffer_allocate(mctx, &buf, MAX_CDS_RDATA_TEXT_SIZE);
result = dns_master_rdatasettotext(name, rdataset, style, NULL, buf);
if ((result == ISC_R_SUCCESS) && isc_buffer_availablelength(buf) < 1) {
......@@ -834,8 +833,7 @@ make_new_ds_set(ds_maker_func_t *ds_from_rdata,
result = dns_rdatalist_tordataset(dslist, &new_ds_set);
check_result(result, "dns_rdatalist_tordataset(dslist)");
result = isc_buffer_allocate(mctx, &new_ds_buf, size);
check_result(result, "building new DS records");
isc_buffer_allocate(mctx, &new_ds_buf, size);
for (result = dns_rdataset_first(rdset);
result == ISC_R_SUCCESS;
......
......@@ -226,8 +226,7 @@ dumpnode(dns_name_t *name, dns_dbnode_t *node) {
dns_rdataset_init(&rds);
result = isc_buffer_allocate(mctx, &buffer, bufsize);
check_result(result, "isc_buffer_allocate");
isc_buffer_allocate(mctx, &buffer, bufsize);
for (result = dns_rdatasetiter_first(iter);
result == ISC_R_SUCCESS;
......@@ -253,8 +252,7 @@ dumpnode(dns_name_t *name, dns_dbnode_t *node) {
bufsize <<= 1;
isc_buffer_free(&buffer);
result = isc_buffer_allocate(mctx, &buffer, bufsize);
check_result(result, "isc_buffer_allocate");
isc_buffer_allocate(mctx, &buffer, bufsize);
}
check_result(result, "dns_master_rdatasettotext");
......
......@@ -445,9 +445,7 @@ control_recvmessage(isc_task_t *task, isc_event_t *event) {
goto cleanup_request;
}
result = isc_buffer_allocate(listener->mctx, &text, 2 * 2048);
if (result != ISC_R_SUCCESS)
goto cleanup_request;
isc_buffer_allocate(listener->mctx, &text, 2 * 2048);
/*
* Establish nonce.
......@@ -493,10 +491,7 @@ control_recvmessage(isc_task_t *task, isc_event_t *event) {
goto cleanup_response;
if (conn->buffer == NULL) {
result = isc_buffer_allocate(listener->mctx,
&conn->buffer, 2 * 2048);
if (result != ISC_R_SUCCESS)
goto cleanup_response;
isc_buffer_allocate(listener->mctx, &conn->buffer, 2 * 2048);
}
isc_buffer_clear(conn->buffer);
......
......@@ -7694,9 +7694,7 @@ data_to_cfg(dns_view_t *view, MDB_val *key, MDB_val *data,
REQUIRE(zoneconfig != NULL && *zoneconfig == NULL);
if (*text == NULL) {
result = isc_buffer_allocate(view->mctx, text, 256);
if (result != ISC_R_SUCCESS)
goto cleanup;
isc_buffer_allocate(view->mctx, text, 256);
} else {
isc_buffer_clear(*text);
}
......@@ -12394,17 +12392,7 @@ nzd_save(MDB_txn **txnp, MDB_dbi dbi, dns_zone_t *zone,
/* We're creating or overwriting the zone */
const cfg_obj_t *zoptions;
result = isc_buffer_allocate(view->mctx, &text, 256);
if (result != ISC_R_SUCCESS) {
isc_log_write(named_g_lctx,
NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER,
ISC_LOG_ERROR,
"Unable to allocate buffer in "
"nzd_save(): %s",
isc_result_totext(result));
goto cleanup;
}
isc_buffer_allocate(view->mctx, &text, 256);
zoptions = cfg_tuple_get(zconfig, "options");
if (zoptions == NULL) {
......@@ -12429,7 +12417,7 @@ nzd_save(MDB_txn **txnp, MDB_dbi dbi, dns_zone_t *zone,
ISC_LOG_ERROR,
"Error writing zone config to "
"buffer in nzd_save(): %s",
isc_result_totext(result));
isc_result_totext(dzarg.result));
result = dzarg.result;
goto cleanup;
}
......@@ -12761,7 +12749,7 @@ migrate_nzf(dns_view_t *view) {
CHECK(nzd_open(view, 0, &txn, &dbi));
CHECK(isc_buffer_allocate(view->mctx, &text, 256));
isc_buffer_allocate(view->mctx, &text, 256);
for (element = cfg_list_first(zonelist);
element != NULL;
......
......@@ -1238,8 +1238,7 @@ parse_name(char **cmdlinep, dns_message_t *msg, dns_name_t **namep) {
result = dns_message_gettempname(msg, namep);
check_result(result, "dns_message_gettempname");
result = isc_buffer_allocate(gmctx, &namebuf, DNS_NAME_MAXWIRE);
check_result(result, "isc_buffer_allocate");
isc_buffer_allocate(gmctx, &namebuf, DNS_NAME_MAXWIRE);
dns_name_init(*namep, NULL);
dns_name_setbuffer(*namep, namebuf);
dns_message_takebuffer(msg, &namebuf);
......@@ -1284,16 +1283,14 @@ parse_rdata(char **cmdlinep, dns_rdataclass_t rdataclass,
isc_buffer_add(&source, strlen(cmdline));
result = isc_lex_openbuffer(lex, &source);
check_result(result, "isc_lex_openbuffer");
result = isc_buffer_allocate(gmctx, &buf, MAXWIRE);
check_result(result, "isc_buffer_allocate");
isc_buffer_allocate(gmctx, &buf, MAXWIRE);
result = dns_rdata_fromtext(NULL, rdataclass, rdatatype, lex,
dns_rootname, 0, gmctx, buf,
&callbacks);
isc_lex_destroy(&lex);
if (result == ISC_R_SUCCESS) {
isc_buffer_usedregion(buf, &r);
result = isc_buffer_allocate(gmctx, &newbuf, r.length);
check_result(result, "isc_buffer_allocate");
isc_buffer_allocate(gmctx, &newbuf, r.length);
isc_buffer_putmem(newbuf, r.base, r.length);
isc_buffer_usedregion(newbuf, &r);
dns_rdata_fromregion(rdata, rdataclass, rdatatype, &r);
......@@ -2041,8 +2038,7 @@ show_message(FILE *stream, dns_message_t *msg, const char *description) {
}
if (buf != NULL)
isc_buffer_free(&buf);
result = isc_buffer_allocate(gmctx, &buf, bufsz);
check_result(result, "isc_buffer_allocate");
isc_buffer_allocate(gmctx, &buf, bufsz);
result = dns_message_totext(msg, style, 0, buf);
bufsz *= 2;
} while (result == ISC_R_NOSPACE);
......
......@@ -965,8 +965,7 @@ main(int argc, char **argv) {
command = *argv;
DO("allocate data buffer",
isc_buffer_allocate(rndc_mctx, &databuf, 2048));
isc_buffer_allocate(rndc_mctx, &databuf, 2048);
/*
* Convert argc/argv into a space-delimited command string
......
......@@ -175,8 +175,7 @@ main(int argc, char *argv[]) {
} else
f = stdin;
result = isc_buffer_allocate(mctx, &input, 64 * 1024);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
isc_buffer_allocate(mctx, &input, 64 * 1024);
if (rawdata) {
while (fread(&c, 1, 1, f) != 0) {
......
......@@ -309,8 +309,7 @@ recvresponse(isc_task_t *task, isc_event_t *event) {
if (!display_comments)
flags |= DNS_MESSAGETEXTFLAG_NOCOMMENTS;
result = isc_buffer_allocate(mctx, &buf, len);
CHECK("isc_buffer_allocate", result);
isc_buffer_allocate(mctx, &buf, len);
if (yaml) {
char sockstr[ISC_SOCKADDR_FORMATSIZE];
......@@ -416,11 +415,8 @@ repopulate_buffer:
buftoosmall:
len += OUTPUTBUF;
isc_buffer_free(&buf);
result = isc_buffer_allocate(mctx, &buf, len);
if (result == ISC_R_SUCCESS)
goto repopulate_buffer;
else
goto cleanup;
isc_buffer_allocate(mctx, &buf, len);
goto repopulate_buffer;
}
CHECK("dns_message_pseudosectiontotext", result);
}
......
......@@ -1239,10 +1239,8 @@ catz_process_apl(dns_catz_zone_t *zone, isc_buffer_t **aclbp,
result = dns_rdata_tostruct(&rdata, &rdata_apl, zone->catzs->mctx);
if (result != ISC_R_SUCCESS)
return (result);
result = isc_buffer_allocate(zone->catzs->mctx, &aclb, 16);
isc_buffer_allocate(zone->catzs->mctx, &aclb, 16);
isc_buffer_setautorealloc(aclb, true);
if (result != ISC_R_SUCCESS)
goto cleanup;
for (result = dns_rdata_apl_first(&rdata_apl);
result == ISC_R_SUCCESS;
result = dns_rdata_apl_next(&rdata_apl)) {
......@@ -1462,12 +1460,9 @@ dns_catz_generate_masterfilename(dns_catz_zone_t *zone, dns_catz_entry_t *entry,
REQUIRE(entry != NULL);
REQUIRE(buffer != NULL && *buffer != NULL);
result = isc_buffer_allocate(zone->catzs->mctx, &tbuf,
strlen(zone->catzs->view->name) +
2 * DNS_NAME_FORMATSIZE + 2);
if (result != ISC_R_SUCCESS)
return (result);
INSIST(tbuf != NULL);
isc_buffer_allocate(zone->catzs->mctx, &tbuf,
strlen(zone->catzs->view->name) + 2 *
DNS_NAME_FORMATSIZE + 2);
isc_buffer_putstr(tbuf, zone->catzs->view->name);
isc_buffer_putstr(tbuf, "_");
......@@ -1552,11 +1547,7 @@ dns_catz_generate_zonecfg(dns_catz_zone_t *zone, dns_catz_entry_t *entry,
* The buffer will be reallocated if something won't fit,
* ISC_BUFFER_INCR seems like a good start.
*/
result = isc_buffer_allocate(zone->catzs->mctx, &buffer,
ISC_BUFFER_INCR);
if (result != ISC_R_SUCCESS) {
goto cleanup;
}
isc_buffer_allocate(zone->catzs->mctx, &buffer, ISC_BUFFER_INCR);
isc_buffer_setautorealloc(buffer, true);
isc_buffer_putstr(buffer, "zone ");
......
......@@ -2556,9 +2556,7 @@ copy_name(isc_mem_t *mctx, dns_message_t *msg, const dns_name_t *name,
result = dns_message_gettempname(msg, &newname);
if (result != ISC_R_SUCCESS)
return (result);
result = isc_buffer_allocate(mctx, &namebuf, DNS_NAME_MAXWIRE);
if (result != ISC_R_SUCCESS)
goto fail;
isc_buffer_allocate(mctx, &namebuf, DNS_NAME_MAXWIRE);
dns_name_init(newname, NULL);
dns_name_setbuffer(newname, namebuf);
dns_message_takebuffer(msg, &namebuf);
......@@ -2587,10 +2585,7 @@ copy_name(isc_mem_t *mctx, dns_message_t *msg, const dns_name_t *name,
goto fail;
dns_rdata_toregion(&rdata, &r);
rdatabuf = NULL;
result = isc_buffer_allocate(mctx, &rdatabuf,
r.length);
if (result != ISC_R_SUCCESS)
goto fail;
isc_buffer_allocate(mctx, &rdatabuf, r.length);
isc_buffer_putmem(rdatabuf, r.base, r.length);
isc_buffer_usedregion(rdatabuf, &r);
dns_rdata_init(newrdata);
......
......@@ -257,9 +257,7 @@ dns_dnssec_sign(const dns_name_t *name, dns_rdataset_t *set, dst_key_t *key,
*/
sig.signature = isc_mem_get(mctx, sig.siglen);
ret = isc_buffer_allocate(mctx, &databuf, sigsize + 256 + 18);
if (ret != ISC_R_SUCCESS)
goto cleanup_signature;
isc_buffer_allocate(mctx, &databuf, sigsize + 256 + 18);
dns_rdata_init(&tmpsigrdata);
ret = dns_rdata_fromstruct(&tmpsigrdata, sig.common.rdclass,
......@@ -355,7 +353,6 @@ cleanup_context:
dst_context_destroy(&ctx);
cleanup_databuf:
isc_buffer_free(&databuf);
cleanup_signature:
isc_mem_put(mctx, sig.signature, sig.siglen);
return (ret);
......@@ -997,7 +994,7 @@ dns_dnssec_signmessage(dns_message_t *msg, dst_key_t *key) {
rdata = NULL;
RETERR(dns_message_gettemprdata(msg, &rdata));
RETERR(isc_buffer_allocate(msg->mctx, &dynbuf, 1024));
isc_buffer_allocate(msg->mctx, &dynbuf, 1024);
RETERR(dns_rdata_fromstruct(rdata, dns_rdataclass_any,
dns_rdatatype_sig /* SIG(0) */,
&sig, dynbuf));
......
......@@ -865,8 +865,8 @@ dst_key_fromgssapi(const dns_name_t *name, gss_ctx_id_t gssctx,
* Keep the token for use by external ssu rules. They may need
* to examine the PAC in the kerberos ticket.
*/
RETERR(isc_buffer_allocate(key->mctx, &key->key_tkeytoken,
intoken->length));
isc_buffer_allocate(key->mctx, &key->key_tkeytoken,
intoken->length);
RETERR(isc_buffer_copyregion(key->key_tkeytoken, intoken));
}
......
......@@ -54,18 +54,12 @@ struct dst_gssapi_signverifyctx {
static isc_result_t
gssapi_create_signverify_ctx(dst_key_t *key, dst_context_t *dctx) {
dst_gssapi_signverifyctx_t *ctx;
isc_result_t result;
UNUSED(key);
ctx = isc_mem_get(dctx->mctx, sizeof(dst_gssapi_signverifyctx_t));
ctx->buffer = NULL;
result = isc_buffer_allocate(dctx->mctx, &ctx->buffer,
INITIAL_BUFFER_SIZE);
if (result != ISC_R_SUCCESS) {
isc_mem_put(dctx->mctx, ctx, sizeof(dst_gssapi_signverifyctx_t));
return (result);
}
isc_buffer_allocate(dctx->mctx, &ctx->buffer, INITIAL_BUFFER_SIZE);
dctx->ctxdata.gssctx = ctx;
......@@ -107,9 +101,7 @@ gssapi_adddata(dst_context_t *dctx, const isc_region_t *data) {
length = isc_buffer_length(ctx->buffer) + data->length + BUFFER_EXTRA;
result = isc_buffer_allocate(dctx->mctx, &newbuffer, length);
if (result != ISC_R_SUCCESS)
return (result);
isc_buffer_allocate(dctx->mctx, &newbuffer, length);
isc_buffer_usedregion(ctx->buffer, &r);
(void)isc_buffer_copyregion(newbuffer, &r);
......@@ -276,9 +268,7 @@ gssapi_restore(dst_key_t *key, const char *keystr) {
len = (len / 4) * 3;
result = isc_buffer_allocate(key->mctx, &b, len);
if (result != ISC_R_SUCCESS)
return (result);
isc_buffer_allocate(key->mctx, &b, len);
result = isc_base64_decodestring(keystr, b);
if (result != ISC_R_SUCCESS) {
......
......@@ -752,8 +752,8 @@ dst_gssapi_acceptctx(gss_cred_id_t cred,
}
if (gouttoken.length > 0U) {
RETERR(isc_buffer_allocate(mctx, outtoken,
(unsigned int)gouttoken.length));
isc_buffer_allocate(mctx, outtoken,
(unsigned int)gouttoken.length);
GBUFFER_TO_REGION(gouttoken, r);
RETERR(isc_buffer_copyregion(*outtoken, &r));
(void)gss_release_buffer(&minor, &gouttoken);
......
......@@ -592,9 +592,7 @@ dns_keytable_dump(dns_keytable_t *keytable, FILE *fp) {
REQUIRE(VALID_KEYTABLE(keytable));
REQUIRE(fp != NULL);
result = isc_buffer_allocate(keytable->mctx, &text, 4096);
if (result != ISC_R_SUCCESS)
return (result);
isc_buffer_allocate(keytable->mctx, &text, 4096);
result = dns_keytable_totext(keytable, &text);
......
......@@ -243,13 +243,10 @@ msgblock_free(isc_mem_t *mctx, dns_msgblock_t *block, unsigned int sizeof_type)
*/
static inline isc_result_t
newbuffer(dns_message_t *msg, unsigned int size) {
isc_result_t result;
isc_buffer_t *dynbuf;
dynbuf = NULL;
result = isc_buffer_allocate(msg->mctx, &dynbuf, size);
if (result != ISC_R_SUCCESS)
return (ISC_R_NOMEMORY);
isc_buffer_allocate(msg->mctx, &dynbuf, size);
ISC_LIST_APPEND(msg->scratchpad, dynbuf, link);
return (ISC_R_SUCCESS);
......@@ -702,7 +699,6 @@ isc_result_t
dns_message_create(isc_mem_t *mctx, unsigned int intent, dns_message_t **msgp)
{
dns_message_t *m;
isc_result_t result;
isc_buffer_t *dynbuf;
unsigned int i;
......@@ -755,33 +751,13 @@ dns_message_create(isc_mem_t *mctx, unsigned int intent, dns_message_t **msgp)
isc_mempool_setname(m->rdspool, "msg:rdataset");
dynbuf = NULL;
result = isc_buffer_allocate(mctx, &dynbuf, SCRATCHPAD_SIZE);
if (result != ISC_R_SUCCESS)
goto cleanup;
isc_buffer_allocate(mctx, &dynbuf, SCRATCHPAD_SIZE);
ISC_LIST_APPEND(m->scratchpad, dynbuf, link);
m->cctx = NULL;
*msgp = m;
return (ISC_R_SUCCESS);
/*
* Cleanup for error returns.
*/
cleanup:
dynbuf = ISC_LIST_HEAD(m->scratchpad);
if (dynbuf != NULL) {
ISC_LIST_UNLINK(m->scratchpad, dynbuf, link);
isc_buffer_free(&dynbuf);
}
if (m->namepool != NULL)
isc_mempool_destroy(&m->namepool);
if (m->rdspool != NULL)
isc_mempool_destroy(&m->rdspool);
m->magic = 0;
isc_mem_putanddetach(&mctx, m, sizeof(dns_message_t));
return (ISC_R_NOMEMORY);
}
void
......@@ -2861,9 +2837,7 @@ dns_message_setquerytsig(dns_message_t *msg, isc_buffer_t *querytsig) {
goto cleanup;
isc_buffer_usedregion(querytsig, &r);
result = isc_buffer_allocate(msg->mctx, &buf, r.length);
if (result != ISC_R_SUCCESS)
goto cleanup;
isc_buffer_allocate(msg->mctx, &buf, r.length);
isc_buffer_putmem(buf, r.base, r.length);
isc_buffer_usedregion(buf, &r);
dns_rdata_init(rdata);
......@@ -2908,9 +2882,7 @@ dns_message_getquerytsig(dns_message_t *msg, isc_mem_t *mctx,
dns_rdataset_current(msg->tsig, &rdata);
dns_rdata_toregion(&rdata, &r);
result = isc_buffer_allocate(mctx, querytsig, r.length);
if (result != ISC_R_SUCCESS)
return (result);
isc_buffer_allocate(mctx, querytsig, r.length);
isc_buffer_putmem(*querytsig, r.base, r.length);
return (ISC_R_SUCCESS);
}
......@@ -3029,9 +3001,7 @@ dns_message_signer(dns_message_t *msg, dns_name_t *signer) {
if (!dns_name_hasbuffer(signer)) {
isc_buffer_t *dynbuf = NULL;
result = isc_buffer_allocate(msg->mctx, &dynbuf, 512);
if (result != ISC_R_SUCCESS)
return (result);
isc_buffer_allocate(msg->mctx, &dynbuf, 512);
dns_name_setbuffer(signer, dynbuf);
dns_message_takebuffer(msg, &dynbuf);
}
......@@ -4475,9 +4445,7 @@ dns_message_buildopt(dns_message_t *message, dns_rdataset_t **rdatasetp,
goto cleanup;
}
result = isc_buffer_allocate(message->mctx, &buf, len);
if (result != ISC_R_SUCCESS)
goto cleanup;
isc_buffer_allocate(message->mctx, &buf, len);
for (i = 0; i < count; i++) {
if (ednsopts[i].code == DNS_OPT_PAD &&
......
......@@ -568,9 +568,7 @@ dns_ntatable_dump(dns_ntatable_t *ntatable, FILE *fp) {
isc_buffer_t *text = NULL;
int len = 4096;
result = isc_buffer_allocate(ntatable->view->mctx, &text, len);
if (result != ISC_R_SUCCESS)
return (result);
isc_buffer_allocate(ntatable->view->mctx, &text, len);
result = dns_ntatable_totext(ntatable, NULL, &text);
......
......@@ -273,16 +273,15 @@ static isc_result_t openssleddsa_todns(const dst_key_t *key,
static isc_result_t
openssleddsa_createctx(dst_key_t *key, dst_context_t *dctx) {
isc_buffer_t *buf = NULL;
isc_result_t result;
UNUSED(key);
REQUIRE(dctx->key->key_alg == DST_ALG_ED25519 ||
dctx->key->key_alg == DST_ALG_ED448);
result = isc_buffer_allocate(dctx->mctx, &buf, 64);
isc_buffer_allocate(dctx->mctx, &buf, 64);
dctx->ctxdata.generic = buf;
return (result);
return (ISC_R_SUCCESS);
}
static void
......@@ -312,9 +311,7 @@ openssleddsa_adddata(dst_context_t *dctx, const isc_region_t *data) {
return (ISC_R_SUCCESS);
length = isc_buffer_length(buf) + data->length + 64;
result = isc_buffer_allocate(dctx->mctx, &nbuf, length);
if (result != ISC_R_SUCCESS)
return (result);
isc_buffer_allocate(dctx->mctx, &nbuf, length);
isc_buffer_usedregion(buf, &r);
(void) isc_buffer_copyregion(nbuf, &r);
(void) isc_buffer_copyregion(nbuf, data);
......
......@@ -108,9 +108,7 @@ pkcs11eddsa_adddata(dst_context_t *dctx, const isc_region_t *data) {
return (ISC_R_SUCCESS);
length = isc_buffer_length(buf) + data->length + 64;
result = isc_buffer_allocate(dctx->mctx, &nbuf, length);
if (result != ISC_R_SUCCESS)
return (result);
isc_buffer_allocate(dctx->mctx, &nbuf, length);
isc_buffer_usedregion(buf, &r);
(void) isc_buffer_copyregion(nbuf, &r);
(void) isc_buffer_copyregion(nbuf, data);
......
......@@ -9884,10 +9884,7 @@ restart:
dns_rdataset_t *sigrdataset_aaaa = NULL;
dns_name_t *gluename = dns_fixedname_name(&ge->fixedname);
result = isc_buffer_allocate(msg->mctx, &buffer, 512);
if (ISC_UNLIKELY(result != ISC_R_SUCCESS)) {
goto no_glue;
}
isc_buffer_allocate(msg->mctx, &buffer, 512);
result = dns_message_gettempname(msg, &name);
if (ISC_UNLIKELY(result != ISC_R_SUCCESS)) {
......
......@@ -857,9 +857,7 @@ unknown_fromtext(dns_rdataclass_t rdclass, dns_rdatatype_t type,
false));
if (token.value.as_ulong > 65535U)
return (ISC_R_RANGE);