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

[libvirt] [PATCH]lxc: goto cleanup if lxcContainerBuildInitCmd returns NULL



From: Chen Hanxiao <chenhanxiao cn fujitsu com>

We should goto cleanup directly
if lxcContainerBuildInitCmd returns NULL,
which would avoid lots of unnecessary works.

Signed-off-by: Chen Hanxiao <chenhanxiao cn fujitsu com>
---
 src/lxc/lxc_container.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 3fdf397..f03f236 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -1820,7 +1820,10 @@ static int lxcContainerChild(void *data)
     if ((hasReboot = lxcContainerHasReboot()) < 0)
         goto cleanup;
 
-    cmd = lxcContainerBuildInitCmd(vmDef);
+    if (!(cmd = lxcContainerBuildInitCmd(vmDef))) {
+        VIR_DEBUG("Failed to build init cmd for container");
+        goto cleanup;
+    }
     virCommandWriteArgLog(cmd, 1);
 
     if (lxcContainerSetID(vmDef) < 0)
-- 
1.8.2.1


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