]> xenbits.xensource.com Git - libvirt.git/commitdiff
lxc: Don't return early in virLXCProcessSetupInterfaces
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 27 Jul 2018 12:32:36 +0000 (14:32 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 27 Jul 2018 12:32:36 +0000 (14:32 +0200)
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>
src/lxc/lxc_process.c

index d021a890f7dfafba31bb6e4cbe932d862df49dc0..442756a6f11d90c8aba6e2ccde6deec98928ea2c 100644 (file)
@@ -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++;
         }
     }