]> 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>
Tue, 28 Sep 2021 01:57:47 +0000 (11:57 +1000)
move deference of obj to after NULL check

lib/isccfg/parser.c

index 37027733dd9c02f692e9ea332996f999e56f8dc3..002255d47eb4ad5cc0c9eb736da4664530b3a830 100644 (file)
@@ -2247,12 +2247,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);