From: Daniel P. Berrange Date: Tue, 29 Oct 2013 13:58:00 +0000 (+0000) Subject: Fix leak of objects when reconnecting to QEMU instances X-Git-Tag: v1.1.3.1~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5ddb57e01ef710f93dfe4ac782a83b74c5bff74c;p=thirdparty%2Flibvirt.git Fix leak of objects when reconnecting to QEMU instances The 'error' cleanup block in qemuProcessReconnect() had a 'return' statement in the middle of it. This caused a leak of virConnectPtr & virQEMUDriverConfigPtr instances. This was identified because netcf recently started checking its refcount in libvirtd shutdown: netcfStateCleanup:109 : internal error: Attempt to close netcf state driver with open connections Signed-off-by: Daniel P. Berrange (cherry picked from commit 54a241122063094146f1bdec9fab38df5617fb68) --- diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 7a30a5ed4e..393110b735 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -3219,10 +3219,7 @@ error: if (!virDomainObjIsActive(obj)) { if (virObjectUnref(obj)) virObjectUnlock(obj); - return; - } - - if (virObjectUnref(obj)) { + } else if (virObjectUnref(obj)) { /* We can't get the monitor back, so must kill the VM * to remove danger of it ending up running twice if * user tries to start it again later