]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
move appending kasp to the list until we can't fail; document why we don't detach
authorMark Andrews <marka@isc.org>
Tue, 5 Nov 2019 02:38:00 +0000 (13:38 +1100)
committerMatthijs Mekking <matthijs@isc.org>
Wed, 6 Nov 2019 21:36:21 +0000 (22:36 +0100)
lib/isccfg/kaspconf.c

index b1111f68911f2d97bc1a46284caf25c2d29b408c..b39eb9c44c50ff94b2c487d36fd38493885125e9 100644 (file)
@@ -143,10 +143,6 @@ cfg_kasp_fromconfig(const cfg_obj_t *config, isc_mem_t* mctx,
        }
        INSIST(kasp != NULL);
 
-       /* Append it to the list for future lookups. */
-       ISC_LIST_APPEND(*kasplist, kasp, link);
-       ISC_INSIST(!(ISC_LIST_EMPTY(*kasplist)));
-
        /* Now configure. */
        INSIST(DNS_KASP_VALID(kasp));
 
@@ -211,8 +207,13 @@ cfg_kasp_fromconfig(const cfg_obj_t *config, isc_mem_t* mctx,
 
        // TODO: Rest of the configuration
 
+       /* Append it to the list for future lookups. */
+       ISC_LIST_APPEND(*kasplist, kasp, link);
+       ISC_INSIST(!(ISC_LIST_EMPTY(*kasplist)));
+
        /* Success: Attach the kasp to the pointer and return. */
        dns_kasp_attach(kasp, kaspp);
+       /* Don't detach as kasp is on '*kasplist' */
        return (ISC_R_SUCCESS);
 
 cleanup: