[libvirt] [PATCH 3/6] storage: Improve code consistency between backends

Richard Laager rlaager at wiktel.com
Tue Mar 15 06:17:33 UTC 2016


This improves the code consistency around freeing vol->target.path in
createVol implementations.
---
 src/storage/storage_backend_logical.c | 2 --
 src/storage/storage_backend_zfs.c     | 6 +-----
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c
index ecbf430..90a194e 100644
--- a/src/storage/storage_backend_logical.c
+++ b/src/storage/storage_backend_logical.c
@@ -921,9 +921,7 @@ virStorageBackendLogicalCreateVol(virConnectPtr conn,
 
     vol->type = VIR_STORAGE_VOL_BLOCK;
 
-    /* A target path passed to CreateVol has no meaning */
     VIR_FREE(vol->target.path);
-
     if (virAsprintf(&vol->target.path, "%s/%s",
                     pool->def->target.path,
                     vol->name) == -1)
diff --git a/src/storage/storage_backend_zfs.c b/src/storage/storage_backend_zfs.c
index 2e6e407..4129aae 100644
--- a/src/storage/storage_backend_zfs.c
+++ b/src/storage/storage_backend_zfs.c
@@ -303,11 +303,7 @@ virStorageBackendZFSCreateVol(virConnectPtr conn ATTRIBUTE_UNUSED,
 
     vol->type = VIR_STORAGE_VOL_BLOCK;
 
-    if (vol->target.path != NULL) {
-        /* A target path passed to CreateVol has no meaning */
-        VIR_FREE(vol->target.path);
-    }
-
+    VIR_FREE(vol->target.path);
     if (virAsprintf(&vol->target.path, "%s/%s",
                     pool->def->target.path, vol->name) == -1)
         return -1;
-- 
2.1.4




More information about the libvir-list mailing list