On 7/21/20 8:04 AM, John Ferlan wrote:


On 7/7/20 5:08 PM, Laine Stump wrote:
All these cleanup/error labels were reduced to having just "return
ret" by a previous patch, so get rid of them and return directly.

Signed-off-by: Laine Stump <la...@redhat.com>
---
  src/network/bridge_driver.c       | 264 ++++++++++++------------------
  src/network/bridge_driver_linux.c |  15 +-
  2 files changed, 113 insertions(+), 166 deletions(-)

diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 31bd0dd92c..79b2ca3330 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c

[...]

Coverity noted there's a leak with this part of the change for @field...

@@ -2207,7 +2164,6 @@ networkSetIPv6Sysctls(virNetworkObjPtr obj)
  {
      virNetworkDefPtr def = virNetworkObjGetDef(obj);
      g_autofree char *field = NULL;
-    int ret = -1;
      bool enableIPv6 = !!virNetworkDefGetIPByIndex(def, AF_INET6, 0);
/* set disable_ipv6 if there are no ipv6 addresses defined for the
@@ -2221,15 +2177,14 @@ networkSetIPv6Sysctls(virNetworkObjPtr obj)
          if (!enableIPv6)
              VIR_DEBUG("ipv6 appears to already be disabled on %s",
                        def->bridge);
-        ret = 0;
-        goto cleanup;
+        return 0;
      }

Below here doesn't match w/ current source, but I assume you know that.
Looks like a mis-merge with the review from the previous patch.

Sigh.

I *thought* I had removed all the changes to this function when I rebased the series the last time (since Jan already had a better patch for it), but I guess I didn't look carefully enough at the diffs before I pushed :-(

Fortunately, Jan has pushed his patch, which completely replaces the function.



if (virFileWriteStr(field, enableIPv6 ? "0" : "1", 0) < 0) {
          virReportSystemError(errno,
                               _("cannot write to %s to enable/disable IPv6 "
                                 "on bridge %s"), field, def->bridge);
-        goto cleanup;
+        return -1;
      }
/* The rest of the ipv6 sysctl tunables should always be set the
@@ -2246,7 +2201,7 @@ networkSetIPv6Sysctls(virNetworkObjPtr obj)
      if (virFileWriteStr(field, "0", 0) < 0) {
          virReportSystemError(errno,
                               _("cannot disable %s"), field);
-        goto cleanup;
+        return -1;
      }
/* All interfaces used as a gateway (which is what this is, by
@@ -2258,12 +2213,10 @@ networkSetIPv6Sysctls(virNetworkObjPtr obj)
      if (virFileWriteStr(field, "0", 0) < 0) {
          virReportSystemError(errno,
                               _("cannot disable %s"), field);
-        goto cleanup;
+        return -1;
      }
- ret = 0;
- cleanup:
-    return ret;
+    return 0;
  }

[...]


Reply via email to