Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx> --- src/conf/nwfilter_params.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/src/conf/nwfilter_params.c b/src/conf/nwfilter_params.c index 0b967e1194..0b1676e25f 100644 --- a/src/conf/nwfilter_params.c +++ b/src/conf/nwfilter_params.c @@ -698,18 +698,15 @@ virNWFilterParseVarValue(const char *val) GHashTable * virNWFilterParseParamAttributes(xmlNodePtr cur) { - char *nam, *val; - virNWFilterVarValue *value; - - GHashTable *table = virHashNew(virNWFilterVarValueHashFree); + g_autoptr(GHashTable) table = virHashNew(virNWFilterVarValueHashFree); cur = xmlFirstElementChild(cur); while (cur != NULL) { if (virXMLNodeNameEqual(cur, "parameter")) { - nam = virXMLPropString(cur, "name"); - val = virXMLPropString(cur, "value"); - value = NULL; + g_autofree char *nam = virXMLPropString(cur, "name"); + g_autofree char *val = virXMLPropString(cur, "value"); + g_autoptr(virNWFilterVarValue) value = NULL; if (nam != NULL && val != NULL) { if (!isValidVarName(nam)) goto skip_entry; @@ -733,20 +730,13 @@ virNWFilterParseParamAttributes(xmlNodePtr cur) value = NULL; } skip_entry: - virNWFilterVarValueFree(value); - VIR_FREE(nam); - VIR_FREE(val); } - cur = xmlNextElementSibling(cur); } - return table; + + return g_steal_pointer(&table); err_exit: - VIR_FREE(nam); - VIR_FREE(val); - virNWFilterVarValueFree(value); - virHashFree(table); return NULL; } -- 2.31.1