From: Peter Krempa Date: Thu, 15 Sep 2022 15:47:49 +0000 (+0200) Subject: virDomainNetIPInfoParseXML: Remove pointless automatic clearing of 'route' and 'ip' X-Git-Tag: v8.9.0-rc1~177 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ecdbc4ea4e7d6e142a6345d99650a903177e7ed1;p=thirdparty%2Flibvirt.git virDomainNetIPInfoParseXML: Remove pointless automatic clearing of 'route' and 'ip' 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 --- 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;