[libvirt PATCH 09/14] lxc: refactor virLXCProcessBuildControllerCmd

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

 



Use automatic cleanup and remove the labels.

Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 src/lxc/lxc_process.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
index 625208c86b..118d9cbdcc 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -935,7 +935,7 @@ virLXCProcessBuildControllerCmd(virLXCDriver *driver,
     size_t i;
     g_autofree char *filterstr = NULL;
     g_autofree char *outputstr = NULL;
-    virCommand *cmd;
+    g_autoptr(virCommand) cmd = NULL;
     g_autoptr(virLXCDriverConfig) cfg = virLXCDriverGetConfig(driver);
 
     cmd = virCommandNew(vm->def->emulator);
@@ -955,7 +955,7 @@ virLXCProcessBuildControllerCmd(virLXCDriver *driver,
     if (cfg->log_libvirtd) {
         if (virLogGetNbOutputs() > 0) {
             if (!(outputstr = virLogGetOutputs()))
-                goto error;
+                return NULL;
 
             virCommandAddEnvPair(cmd, "LIBVIRT_LOG_OUTPUTS", outputstr);
         }
@@ -1007,12 +1007,7 @@ virLXCProcessBuildControllerCmd(virLXCDriver *driver,
      * write the live domain status XML with the PID */
     virCommandRequireHandshake(cmd);
 
- cleanup:
-     return cmd;
- error:
-    virCommandFree(cmd);
-    cmd = NULL;
-    goto cleanup;
+    return g_steal_pointer(&cmd);
 }
 
 
-- 
2.31.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux