]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Address use before NULL check warning of obj
authorMark Andrews <marka@isc.org>
Tue, 28 Sep 2021 00:14:02 +0000 (10:14 +1000)
committerMark Andrews <marka@isc.org>
Wed, 29 Sep 2021 01:43:14 +0000 (11:43 +1000)
move deference of obj to after NULL check

(cherry picked from commit 06a69e03ac84c48e095fe539ae3cf5bbcfebb695)

lib/isccfg/parser.c

index 0dc8496e4e9676de45a9fd0d5bca7f9186ec7cff..7393c6ba103b09a329434e9ed423b4d463c76f18 100644 (file)
@@ -2264,12 +2264,14 @@ cleanup:
 
 void
 cfg_print_spacelist(cfg_printer_t *pctx, const cfg_obj_t *obj) {
-       const cfg_list_t *list = &obj->value.list;
-       const cfg_listelt_t *elt;
+       const cfg_list_t *list = NULL;
+       const cfg_listelt_t *elt = NULL;
 
        REQUIRE(pctx != NULL);
        REQUIRE(obj != NULL);
 
+       list = &obj->value.list;
+
        for (elt = ISC_LIST_HEAD(*list); elt != NULL;
             elt = ISC_LIST_NEXT(elt, link)) {
                cfg_print_obj(pctx, elt->obj);