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

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



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


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