[PATCH 10/11] conf: snapshot: Provide a function to free virDomainSnapshotDiskDefPtr

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

 



Tests will need to parse such a definition so it also needs to be freed.
Provide a function for it.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/conf/snapshot_conf.c | 11 +++++++++++
 src/conf/snapshot_conf.h |  1 +
 2 files changed, 12 insertions(+)

diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c
index 247d3f71b0..f3385d930b 100644
--- a/src/conf/snapshot_conf.c
+++ b/src/conf/snapshot_conf.c
@@ -95,6 +95,17 @@ virDomainSnapshotDiskDefClear(virDomainSnapshotDiskDefPtr disk)
     disk->src = NULL;
 }

+void
+virDomainSnapshotDiskDefFree(virDomainSnapshotDiskDefPtr disk)
+{
+    if (!disk)
+        return;
+
+    virDomainSnapshotDiskDefClear(disk);
+    VIR_FREE(disk);
+}
+
+
 /* Allocate a new virDomainSnapshotDef; free with virObjectUnref() */
 virDomainSnapshotDefPtr
 virDomainSnapshotDefNew(void)
diff --git a/src/conf/snapshot_conf.h b/src/conf/snapshot_conf.h
index f4be434afc..445899dd07 100644
--- a/src/conf/snapshot_conf.h
+++ b/src/conf/snapshot_conf.h
@@ -114,6 +114,7 @@ virDomainSnapshotDefPtr virDomainSnapshotDefParseNode(xmlDocPtr xml,
                                                       bool *current,
                                                       unsigned int flags);
 virDomainSnapshotDefPtr virDomainSnapshotDefNew(void);
+void virDomainSnapshotDiskDefFree(virDomainSnapshotDiskDefPtr disk);
 char *virDomainSnapshotDefFormat(const char *uuidstr,
                                  virDomainSnapshotDefPtr def,
                                  virCapsPtr caps,
-- 
2.21.0

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

  Powered by Linux