]> xenbits.xensource.com Git - libvirt.git/commitdiff
storage: Improve code consistency between backends
authorRichard Laager <rlaager@wiktel.com>
Tue, 15 Mar 2016 06:17:33 +0000 (01:17 -0500)
committerRoman Bogorodskiy <bogorodskiy@gmail.com>
Mon, 21 Mar 2016 05:46:57 +0000 (08:46 +0300)
This improves the code consistency around freeing vol->target.path in
createVol implementations.

src/storage/storage_backend_logical.c
src/storage/storage_backend_zfs.c

index ecbf43054428ff1b5fc57d48987c2a4a087b6920..90a194ebc44c75f84bfa03e97fa1b96554e6f9cf 100644 (file)
@@ -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)
index 2e6e40792c5d4cc2604ca94abb1164bb8ddb783b..4129aaeb6d3ad0f8130c2acca61f54ad3c6a0324 100644 (file)
@@ -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;