[libvirt] [PATCH] lxc: Don't return early in virLXCProcessSetupInterfaces

Michal Privoznik posted 1 patch 5 years, 9 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/6d4163a03e89beeabc9c843851ea7ffcae2b11fc.1532694849.git.mprivozn@redhat.com
Test syntax-check passed
src/lxc/lxc_process.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[libvirt] [PATCH] lxc: Don't return early in virLXCProcessSetupInterfaces
Posted by Michal Privoznik 5 years, 9 months ago
There are two places in the loop body that just return instead of
jumping onto the cleanup label. The problem is the cleanup code
is not ran in those cases.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---

Pushed under trivial rule.

 src/lxc/lxc_process.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
index d021a890f7..442756a6f1 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -544,7 +544,7 @@ static int virLXCProcessSetupInterfaces(virConnectPtr conn,
         net = def->nets[i];
 
         if (virLXCProcessValidateInterface(net) < 0)
-            return -1;
+            goto cleanup;
 
         if (virDomainNetAllocateActualDevice(def, net) < 0)
             goto cleanup;
@@ -612,7 +612,7 @@ static int virLXCProcessSetupInterfaces(virConnectPtr conn,
         /* Make sure all net definitions will have a name in the container */
         if (!net->ifname_guest) {
             if (virAsprintf(&net->ifname_guest, "eth%zu", niface) < 0)
-                return -1;
+                goto cleanup;
             niface++;
         }
     }
-- 
2.16.4

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