]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
python: ensure QEMUQtestProtocol closes its socket
authorDaniel P. Berrangé <berrange@redhat.com>
Tue, 15 Jul 2025 14:30:20 +0000 (15:30 +0100)
committerJohn Snow <jsnow@redhat.com>
Mon, 15 Sep 2025 18:36:01 +0000 (14:36 -0400)
While QEMUQtestMachine closes the socket that was passed to
QEMUQtestProtocol, the python resource leak manager still
believes that the copy QEMUQtestProtocol holds is open. We
must explicitly call close to avoid this leak warnnig.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
python/qemu/machine/qtest.py

index 4f5ede85b2372cce7ad515cf686adafd7233a1e2..781f674ffafd6db65f3f8399d427fd08fbcab2bc 100644 (file)
@@ -177,6 +177,8 @@ class QEMUQtestMachine(QEMUMachine):
             self._qtest_sock_pair[0].close()
             self._qtest_sock_pair[1].close()
             self._qtest_sock_pair = None
+        if self._qtest is not None:
+            self._qtest.close()
         super()._post_shutdown()
 
     def qtest(self, cmd: str) -> str: