于 2010年10月28日 11:06, Hu Tao 写道:
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;
how could you unref the domain ref? it returns here.. :-)
it even will give up closing priv->mon.
}
/* 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;
}