From: James Jones Date: Fri, 26 May 2023 11:59:47 +0000 (-0500) Subject: Skip recursive _raddict_export() call if children == NULL X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=79f7aa3a6c359c24f2e033de0024ff9c20a6df5d;p=thirdparty%2Ffreeradius-server.git Skip recursive _raddict_export() call if children == NULL Arguably a redundant test, but the alternative would be to model talloc_array_length() to make clear to coverity that it returns zero if handed NULL, and we're not sure that modeling functions can check their parameters. --- diff --git a/src/bin/radict.c b/src/bin/radict.c index 6795c2fc5fb..7e62071b5ad 100644 --- a/src/bin/radict.c +++ b/src/bin/radict.c @@ -263,11 +263,12 @@ static void _raddict_export(fr_dict_t const *dict, uint64_t *count, uintptr_t *l * Todo - Should be fixed to use attribute walking API */ children = dict_attr_children(da); - len = talloc_array_length(children); - for (i = 0; i < len; i++) { - /* coverity[dereference] */ - for (p = children[i]; p; p = p->next) { - _raddict_export(dict, count, low, high, p, lvl + 1); + if (children) { + len = talloc_array_length(children); + for (i = 0; i < len; i++) { + for (p = children[i]; p; p = p->next) { + _raddict_export(dict, count, low, high, p, lvl + 1); + } } } }