[PATCH] qemu: Unref domain on error of opening qemu monitor

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

 



The domain refed will be left unrefed when there is error when opening
qemu monitor, so unref it.
---
 src/qemu/qemu_driver.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 25695df..4bcfb27 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1385,7 +1385,7 @@ qemuConnectMonitor(struct qemud_driver *driver, virDomainObjPtr vm)
           (driver->securityDriver,vm) < 0) {
         VIR_ERROR(_("Failed to set security context for monitor for %s"),
                   vm->def->name);
-        goto error;
+        return ret;
     }
 
     /* Hold an extra reference because we can't allow 'vm' to be
@@ -1420,8 +1420,10 @@ qemuConnectMonitor(struct qemud_driver *driver, virDomainObjPtr vm)
     qemuDomainObjExitMonitorWithDriver(driver, vm);
 
 error:
-    if (ret < 0)
+    if (ret < 0) {
         qemuMonitorClose(priv->mon);
+        virDomainObjUnref(vm);
+    }
 
     return ret;
 }
-- 
1.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]