[libvirt-glib 13/13] Fix memory leaks in test-domain-create

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

 



Before the introduction of GVirConfigXmlDoc, we couldn't
destroy the objects deriving from GVirConfigObject without
memory corruption. Now that we have GVirConfigXmlDoc, we can
make sure the memory we allocate for our various
GVirConfigObject instances are properly cleaned up.
---
 libvirt-gconfig/tests/test-domain-create.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/libvirt-gconfig/tests/test-domain-create.c b/libvirt-gconfig/tests/test-domain-create.c
index bade013..9491f36 100644
--- a/libvirt-gconfig/tests/test-domain-create.c
+++ b/libvirt-gconfig/tests/test-domain-create.c
@@ -66,6 +66,7 @@ int main(void)
     klock = gvir_config_domain_clock_new();
     gvir_config_domain_clock_set_offset(klock, GVIR_CONFIG_DOMAIN_CLOCK_UTC);
     gvir_config_domain_set_clock(domain, klock);
+    g_object_unref(G_OBJECT(klock));
 
     /* os node */
     GVirConfigDomainOs *os;
@@ -82,6 +83,7 @@ int main(void)
     g_list_free(devices);
     devices = NULL;
     gvir_config_domain_set_os(domain, os);
+    g_object_unref(G_OBJECT(os));
 
     /* disk node */
     GVirConfigDomainDisk *disk;
@@ -130,6 +132,7 @@ int main(void)
 
 
     gvir_config_domain_set_devices(domain, devices);
+    g_list_foreach(devices, (GFunc)g_object_unref, NULL);
     g_list_free(devices);
     devices = NULL;
 
-- 
1.7.7.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]