From: Chen Hanxiao <chenhanxiao@xxxxxxxxxxxxxx> We should goto cleanup directly if lxcContainerBuildInitCmd returns NULL, which would avoid lots of unnecessary works. Signed-off-by: Chen Hanxiao <chenhanxiao@xxxxxxxxxxxxxx> --- 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 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list