From ecdbc4ea4e7d6e142a6345d99650a903177e7ed1 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Thu, 15 Sep 2022 17:47:49 +0200 Subject: [PATCH] virDomainNetIPInfoParseXML: Remove pointless automatic clearing of 'route' and 'ip' MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Ján Tomko --- src/conf/domain_conf.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 574d962a55..292bd1937c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -6216,17 +6216,17 @@ virDomainNetIPInfoParseXML(const char *source, 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; @@ -6238,6 +6238,8 @@ virDomainNetIPInfoParseXML(const char *source, goto cleanup; for (i = 0; i < nnodes; i++) { + virNetDevIPRoute *route = NULL; + if (!(route = virNetDevIPRouteParseXML(source, nodes[i], ctxt))) goto cleanup; -- 2.47.2