Do not use REQUIRE in dns_catz_entry_detach() after other code

The REQUIRE checks should be at the top of the function before
any assignments or code.

Move the REQUIRE check to the top.
This commit is contained in:
Aram Sargsyan
2022-03-25 11:49:12 +00:00
parent 59c486391d
commit 99d1ec6c4b

View File

@@ -315,10 +315,9 @@ dns_catz_entry_detach(dns_catz_zone_t *zone, dns_catz_entry_t **entryp) {
dns_catz_entry_t *entry;
REQUIRE(DNS_CATZ_ZONE_VALID(zone));
REQUIRE(entryp != NULL);
REQUIRE(entryp != NULL && DNS_CATZ_ENTRY_VALID(*entryp));
entry = *entryp;
*entryp = NULL;
REQUIRE(DNS_CATZ_ENTRY_VALID(entry));
if (isc_refcount_decrement(&entry->refs) == 1) {
isc_mem_t *mctx = zone->catzs->mctx;