[libvirt PATCH 04/20] openvz: refactor openvzDomainDefineCmd

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

 



Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 src/openvz/openvz_driver.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index ce3262c0e2..efd334a235 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -118,15 +118,14 @@ openvzDomObjFromDomain(struct openvz_driver *driver,
 static virCommand *
 openvzDomainDefineCmd(virDomainDef *vmdef)
 {
-    virCommand *cmd = virCommandNewArgList(VZCTL,
-                                             "--quiet",
-                                             "create",
-                                             NULL);
+    g_autoptr(virCommand) cmd = virCommandNewArgList(VZCTL,
+                                                     "--quiet",
+                                                     "create",
+                                                     NULL);
 
     if (vmdef == NULL) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        _("Container is not defined"));
-        virCommandFree(cmd);
         return NULL;
     }
 
@@ -137,7 +136,7 @@ openvzDomainDefineCmd(virDomainDef *vmdef)
         virCommandAddArgList(cmd, "--ostemplate", vmdef->fss[0]->src, NULL);
     }
 
-    return cmd;
+    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