[libvirt PATCH 11/14] storage: logical: use two cmd vars in GetPoolSources

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

 



Do not mix manual and automatic freeing.

Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 src/storage/storage_backend_logical.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c
index ed490b0201..3f27e63aeb 100644
--- a/src/storage/storage_backend_logical.c
+++ b/src/storage/storage_backend_logical.c
@@ -477,23 +477,23 @@ virStorageBackendLogicalGetPoolSources(virStoragePoolSourceList *sourceList)
     int vars[] = {
         2
     };
-    g_autoptr(virCommand) cmd = NULL;
+    g_autoptr(virCommand) vgcmd = NULL;
+    g_autoptr(virCommand) pvcmd = NULL;
 
     /*
      * NOTE: ignoring errors here; this is just to "touch" any logical volumes
      * that might be hanging around, so if this fails for some reason, the
      * worst that happens is that scanning doesn't pick everything up
      */
-    cmd = virCommandNew(VGSCAN);
-    if (virCommandRun(cmd, NULL) < 0)
+    vgcmd = virCommandNew(VGSCAN);
+    if (virCommandRun(vgcmd, NULL) < 0)
         VIR_WARN("Failure when running vgscan to refresh physical volumes");
-    virCommandFree(cmd);
 
-    cmd = virCommandNewArgList(PVS,
-                               "--noheadings",
-                               "-o", "pv_name,vg_name",
-                               NULL, NULL);
-    return virCommandRunRegex(cmd, 1, regexes, vars,
+    pvcmd = virCommandNewArgList(PVS,
+                                 "--noheadings",
+                                 "-o", "pv_name,vg_name",
+                                 NULL, NULL);
+    return virCommandRunRegex(pvcmd, 1, regexes, vars,
                               virStorageBackendLogicalFindPoolSourcesFunc,
                               sourceList, "pvs", NULL);
 }
-- 
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