]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Do not use REQUIRE in dns_catz_entry_detach() after other code
authorAram Sargsyan <aram@isc.org>
Fri, 25 Mar 2022 11:49:12 +0000 (11:49 +0000)
committerAram Sargsyan <aram@isc.org>
Thu, 14 Apr 2022 20:41:52 +0000 (20:41 +0000)
The REQUIRE checks should be at the top of the function before
any assignments or code.

Move the REQUIRE check to the top.

lib/dns/catz.c

index 46dd479816c298ba6d9e9e502c8c9b6df3e8f89c..f3dbbc39896cc0d2592c4cd1bd8ddb029d97f8d7 100644 (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;