]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Fix leak of objects when reconnecting to QEMU instances
authorDaniel P. Berrange <berrange@redhat.com>
Tue, 29 Oct 2013 13:58:00 +0000 (13:58 +0000)
committerCole Robinson <crobinso@redhat.com>
Wed, 6 Nov 2013 16:44:55 +0000 (11:44 -0500)
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 <berrange@redhat.com>
(cherry picked from commit 54a241122063094146f1bdec9fab38df5617fb68)

src/qemu/qemu_process.c

index 7a30a5ed4e40f70e495895663ee16b0f8e597519..393110b735d97943962186b416f4d8b9d32f5979 100644 (file)
@@ -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