From 06a69e03ac84c48e095fe539ae3cf5bbcfebb695 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Tue, 28 Sep 2021 10:14:02 +1000 Subject: [PATCH] Address use before NULL check warning of obj move deference of obj to after NULL check --- lib/isccfg/parser.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/isccfg/parser.c b/lib/isccfg/parser.c index 37027733dd..002255d47e 100644 --- a/lib/isccfg/parser.c +++ b/lib/isccfg/parser.c @@ -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);