]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
util: storagefile: Introduce helper to free storage source perms
authorPeter Krempa <pkrempa@redhat.com>
Thu, 12 Jun 2014 14:11:43 +0000 (16:11 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 20 Jun 2014 07:14:47 +0000 (09:14 +0200)
It will also be reused later.

src/util/virstoragefile.c

index 09b5d10e1ef3c5fb9fb70b0411f4a021a30b9462..a23ac6a48fc65b1dbc0d92eae3368057424125b7 100644 (file)
@@ -1451,6 +1451,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)
@@ -1564,10 +1575,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);