[PATCH v1 04/31] networkGetNetworkAddress: Drop empty 'error' label

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

 



Moreover, there are two points within the function, where we're
missing 'goto cleanup'. Fix this too.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/network/bridge_driver.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index f2026fb..019cb41 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -4560,7 +4560,7 @@ networkGetNetworkAddress(const char *netname, char **netaddr)
         virReportError(VIR_ERR_NO_NETWORK,
                        _("no network with matching name '%s'"),
                        netname);
-        goto error;
+        goto cleanup;
     }
     netdef = network->def;
 
@@ -4574,7 +4574,7 @@ networkGetNetworkAddress(const char *netname, char **netaddr)
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("network '%s' doesn't have an IPv4 address"),
                            netdef->name);
-            break;
+            goto cleanup;
         }
         addrptr = &ipdef->address;
         break;
@@ -4596,19 +4596,20 @@ networkGetNetworkAddress(const char *netname, char **netaddr)
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("network '%s' has no associated interface or bridge"),
                            netdef->name);
+            goto cleanup;
         }
         break;
     }
 
     if (dev_name) {
         if (virNetDevGetIPv4Address(dev_name, &addr) < 0)
-            goto error;
+            goto cleanup;
         addrptr = &addr;
     }
 
     if (!(addrptr &&
           (*netaddr = virSocketAddrFormat(addrptr)))) {
-        goto error;
+        goto cleanup;
     }
 
     ret = 0;
@@ -4616,9 +4617,6 @@ networkGetNetworkAddress(const char *netname, char **netaddr)
     if (network)
         virNetworkObjUnlock(network);
     return ret;
-
- error:
-    goto cleanup;
 }
 
 /**
-- 
2.0.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[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]