2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

Cleanup dns_message_gettemp*() functions - they cannot fail

The dns_message_gettempname(), dns_message_gettemprdata(),
dns_message_gettemprdataset(), and dns_message_gettemprdatalist() always
succeeds because the memory allocation cannot fail now.  Change the API
to return void and cleanup all the use of aforementioned functions.
This commit is contained in:
Ondřej Surý
2022-05-16 13:28:13 +02:00
parent edbb52c95c
commit 33ba0057a7
18 changed files with 277 additions and 431 deletions

View File

@@ -2456,14 +2456,8 @@ resquery_send(resquery_t *query) {
return (ISC_R_SHUTTINGDOWN);
}
result = dns_message_gettempname(fctx->qmessage, &qname);
if (result != ISC_R_SUCCESS) {
goto cleanup_temps;
}
result = dns_message_gettemprdataset(fctx->qmessage, &qrdataset);
if (result != ISC_R_SUCCESS) {
goto cleanup_temps;
}
dns_message_gettempname(fctx->qmessage, &qname);
dns_message_gettemprdataset(fctx->qmessage, &qrdataset);
fctx->qmessage->opcode = dns_opcode_query;
@@ -2474,8 +2468,6 @@ resquery_send(resquery_t *query) {
dns_rdataset_makequestion(qrdataset, res->rdclass, fctx->type);
ISC_LIST_APPEND(qname->list, qrdataset, link);
dns_message_addname(fctx->qmessage, qname, DNS_SECTION_QUESTION);
qname = NULL;
qrdataset = NULL;
/*
* Set RD if the client has requested that we do a recursive
@@ -2862,14 +2854,6 @@ cleanup_message:
*/
dns_dispatch_done(&query->dispentry);
cleanup_temps:
if (qname != NULL) {
dns_message_puttempname(fctx->qmessage, &qname);
}
if (qrdataset != NULL) {
dns_message_puttemprdataset(fctx->qmessage, &qrdataset);
}
return (result);
}