The variables are only used in code paths which can't fail after they
are allocated.
Additionally decrease scope of the variables.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
xmlXPathContextPtr ctxt,
virNetDevIPInfo *def)
{
- g_autoptr(virNetDevIPRoute) route = NULL;
int nnodes;
int ret = -1;
size_t i;
g_autofree xmlNodePtr *nodes = NULL;
- g_autofree virNetDevIPAddr *ip = NULL;
if ((nnodes = virXPathNodeSet("./ip", ctxt, &nodes)) < 0)
goto cleanup;
for (i = 0; i < nnodes; i++) {
+ virNetDevIPAddr *ip = NULL;
+
if (!(ip = virDomainNetIPParseXML(nodes[i])))
goto cleanup;
goto cleanup;
for (i = 0; i < nnodes; i++) {
+ virNetDevIPRoute *route = NULL;
+
if (!(route = virNetDevIPRouteParseXML(source, nodes[i], ctxt)))
goto cleanup;