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

Add RUNTIME_CHECK() around result = dns_name_copy(..., NULL) calls

This second commit uses second semantic patch to replace the calls to
dns_name_copy() with NULL as third argument where the result was stored in a
isc_result_t variable.  As the dns_name_copy(..., NULL) cannot fail gracefully
when the third argument is NULL, it was just a bunch of dead code.

Couple of manual tweaks (removing dead labels and unused variables) were
manually applied on top of the semantic patch.
This commit is contained in:
Ondřej Surý
2019-09-10 13:55:18 +02:00
committed by Mark Andrews
parent 35bd7e4da0
commit 89b269b0d2
15 changed files with 26 additions and 120 deletions

View File

@@ -1365,9 +1365,7 @@ dns_client_startresolve(dns_client_t *client, const dns_name_t *name,
rctx->sigrdataset = sigrdataset;
dns_fixedname_init(&rctx->name);
result = dns_name_copy(name, dns_fixedname_name(&rctx->name), NULL);
if (result != ISC_R_SUCCESS)
goto cleanup;
RUNTIME_CHECK(dns_name_copy(name, dns_fixedname_name(&rctx->name), NULL) == ISC_R_SUCCESS);
rctx->client = client;
ISC_LINK_INIT(rctx, link);
@@ -2167,9 +2165,7 @@ process_soa(updatectx_t *uctx, dns_rdataset_t *soaset,
if (uctx->zonename == NULL) {
uctx->zonename = dns_fixedname_name(&uctx->zonefname);
result = dns_name_copy(soaname, uctx->zonename, NULL);
if (result != ISC_R_SUCCESS)
goto out;
RUNTIME_CHECK(dns_name_copy(soaname, uctx->zonename, NULL) == ISC_R_SUCCESS);
}
if (uctx->currentserver != NULL)
@@ -2206,7 +2202,6 @@ process_soa(updatectx_t *uctx, dns_rdataset_t *soaset,
UNLOCK(&uctx->lock);
}
out:
dns_rdata_freestruct(&soa);
return (result);
@@ -2546,9 +2541,7 @@ copy_name(isc_mem_t *mctx, dns_message_t *msg, const dns_name_t *name,
dns_name_init(newname, NULL);
dns_name_setbuffer(newname, namebuf);
dns_message_takebuffer(msg, &namebuf);
result = dns_name_copy(name, newname, NULL);
if (result != ISC_R_SUCCESS)
goto fail;
RUNTIME_CHECK(dns_name_copy(name, newname, NULL) == ISC_R_SUCCESS);
for (rdataset = ISC_LIST_HEAD(name->list); rdataset != NULL;
rdataset = ISC_LIST_NEXT(rdataset, link)) {