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