[PATCH 08/37] virDomainNetIPInfoParseXML: Remove pointless automatic clearing of 'route' and 'ip'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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 745a7e428c..5c91cbd0db 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.37.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux