[RFC PATCH 3/5] util: storagefile: Introduce helper to free storage source perms

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

 



It will also be reused later.
---
 src/util/virstoragefile.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 0792dd8..67c1471 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -1444,6 +1444,17 @@ virStorageNetHostDefFree(size_t nhosts,
 }


+static void
+virStoragePermsFree(virStoragePermsPtr def)
+{
+    if (!def)
+        return;
+
+    VIR_FREE(def->label);
+    VIR_FREE(def);
+}
+
+
 virStorageNetHostDefPtr
 virStorageNetHostDefCopy(size_t nhosts,
                          virStorageNetHostDefPtr hosts)
@@ -1557,10 +1568,7 @@ virStorageSourceClear(virStorageSourcePtr def)
             virSecurityDeviceLabelDefFree(def->seclabels[i]);
         VIR_FREE(def->seclabels);
     }
-    if (def->perms) {
-        VIR_FREE(def->perms->label);
-        VIR_FREE(def->perms);
-    }
+    virStoragePermsFree(def->perms);
     VIR_FREE(def->timestamps);

     virStorageNetHostDefFree(def->nhosts, def->hosts);
-- 
1.9.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[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]