`cur` is guaranteed to be of type `XML_ELEMENT_NODE` by using `xmlFirstElementChild()` and `xmlNextElementSibling()`. Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx> --- src/conf/nwfilter_params.c | 57 +++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/src/conf/nwfilter_params.c b/src/conf/nwfilter_params.c index 3754cec55f..0b967e1194 100644 --- a/src/conf/nwfilter_params.c +++ b/src/conf/nwfilter_params.c @@ -706,39 +706,38 @@ virNWFilterParseParamAttributes(xmlNodePtr cur) cur = xmlFirstElementChild(cur); while (cur != NULL) { - if (cur->type == XML_ELEMENT_NODE) { - if (virXMLNodeNameEqual(cur, "parameter")) { - nam = virXMLPropString(cur, "name"); - val = virXMLPropString(cur, "value"); - value = NULL; - if (nam != NULL && val != NULL) { - if (!isValidVarName(nam)) - goto skip_entry; - if (!isValidVarValue(val)) - goto skip_entry; - value = virHashLookup(table, nam); - if (value) { - /* add value to existing value -> list */ - if (virNWFilterVarValueAddValue(value, val) < 0) { - value = NULL; - goto err_exit; - } - val = NULL; - } else { - value = virNWFilterParseVarValue(val); - if (!value) - goto skip_entry; - if (virHashUpdateEntry(table, nam, value) < 0) - goto err_exit; + if (virXMLNodeNameEqual(cur, "parameter")) { + nam = virXMLPropString(cur, "name"); + val = virXMLPropString(cur, "value"); + value = NULL; + if (nam != NULL && val != NULL) { + if (!isValidVarName(nam)) + goto skip_entry; + if (!isValidVarValue(val)) + goto skip_entry; + value = virHashLookup(table, nam); + if (value) { + /* add value to existing value -> list */ + if (virNWFilterVarValueAddValue(value, val) < 0) { + value = NULL; + goto err_exit; } - value = NULL; + val = NULL; + } else { + value = virNWFilterParseVarValue(val); + if (!value) + goto skip_entry; + if (virHashUpdateEntry(table, nam, value) < 0) + goto err_exit; } - skip_entry: - virNWFilterVarValueFree(value); - VIR_FREE(nam); - VIR_FREE(val); + value = NULL; } + skip_entry: + virNWFilterVarValueFree(value); + VIR_FREE(nam); + VIR_FREE(val); } + cur = xmlNextElementSibling(cur); } return table; -- 2.31.1