[libvirt-designer 7/7] Fix GVirConfigDomainDiskDriver leak

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

 



A GVirConfigDomainDiskDriver is created in
gvir_designer_domain_add_disk_full but it's never unref'ed. This commit
fixes that, including when an error occurs.
---
 libvirt-designer/libvirt-designer-domain.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libvirt-designer/libvirt-designer-domain.c b/libvirt-designer/libvirt-designer-domain.c
index a060a81..c1a0e83 100644
--- a/libvirt-designer/libvirt-designer-domain.c
+++ b/libvirt-designer/libvirt-designer-domain.c
@@ -1626,6 +1626,8 @@ gvir_designer_domain_add_disk_full(GVirDesignerDomain *design,
     gvir_config_domain_disk_set_type(disk, type);
     gvir_config_domain_disk_set_source(disk, path);
     gvir_config_domain_disk_set_driver(disk, driver);
+    g_object_unref(driver);
+    driver = NULL;
 
     controller = gvir_designer_domain_get_preferred_disk_controller(design, NULL);
     if (controller == NULL)
@@ -1656,6 +1658,8 @@ gvir_designer_domain_add_disk_full(GVirDesignerDomain *design,
 
 error:
     g_free(target_gen);
+    if (driver != NULL)
+        g_object_unref(driver);
     if (disk)
         g_object_unref(disk);
     return NULL;
-- 
2.1.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]