g_autofree xmlNodePtr *nodes = NULL;
int ret = -1, n = 0;
size_t i;
- char *type = NULL;
ctxt->node = node;
goto out;
for (i = 0; i < n; ++i) {
+ g_autofree char *type = NULL;
type = virXMLPropString(nodes[i], "type");
if (!type) {
type, def->name);
goto out;
}
-
- VIR_FREE(type);
}
ret = 0;
out:
- VIR_FREE(type);
return ret;
}
g_autofree xmlNodePtr *nodes = NULL;
int ret = -1, n = 0;
size_t i;
- char *type = NULL;
ctxt->node = node;
goto out;
for (i = 0; i < n; i++) {
+ g_autofree char *type = NULL;
type = virXMLPropString(nodes[i], "type");
if (!type) {
type, def->name);
goto out;
}
-
- VIR_FREE(type);
}
ret = 0;
out:
- VIR_FREE(type);
return ret;
}
xmlNodePtr lnk;
size_t i = -1;
int ret = -1, n = -1;
- char *tmp = NULL;
+ g_autofree char *type = NULL;
g_autofree xmlNodePtr *nodes = NULL;
ctxt->node = node;
net->features = virBitmapNew(VIR_NET_DEV_FEAT_LAST);
for (i = 0; i < n; i++) {
+ g_autofree char *tmp = NULL;
int val;
if (!(tmp = virXMLPropString(nodes[i], "name"))) {
virReportError(VIR_ERR_XML_ERROR, "%s",
goto out;
}
ignore_value(virBitmapSetBit(net->features, val));
- VIR_FREE(tmp);
}
net->subtype = VIR_NODE_DEV_CAP_NET_LAST;
- tmp = virXPathString("string(./capability/@type)", ctxt);
- if (tmp) {
- int val = virNodeDevNetCapTypeFromString(tmp);
- VIR_FREE(tmp);
+ type = virXPathString("string(./capability/@type)", ctxt);
+ if (type) {
+ int val = virNodeDevNetCapTypeFromString(type);
if (val < 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("invalid network type supplied for '%s'"),
ret = 0;
out:
- VIR_FREE(tmp);
return ret;
}