From: Markus Armbruster <armbru@redhat.com>
vmsr_open_socket() leaks the Error set by
qio_channel_socket_connect_sync(). Plug the leak by not creating the
Error.
Fixes: 0418f90809ae (Add support for RAPL MSRs in KVM/Qemu)
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20250723133257.1497640-2-armbru@redhat.com>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
(cherry picked from commit b2e4534a2c9ce3d20ba44d855f1e2b71cc53c3a3)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/target/i386/kvm/vmsr_energy.c b/target/i386/kvm/vmsr_energy.c
index 31508d4e77..4be85f0bf2 100644
--- a/target/i386/kvm/vmsr_energy.c
+++ b/target/i386/kvm/vmsr_energy.c
@@ -67,13 +67,9 @@ QIOChannelSocket *vmsr_open_socket(const char *path)
};
QIOChannelSocket *sioc = qio_channel_socket_new();
- Error *local_err = NULL;
qio_channel_set_name(QIO_CHANNEL(sioc), "vmsr-helper");
- qio_channel_socket_connect_sync(sioc,
- &saddr,
- &local_err);
- if (local_err) {
+ if (qio_channel_socket_connect_sync(sioc, &saddr, NULL) < 0) {
/* Close socket. */
qio_channel_close(QIO_CHANNEL(sioc), NULL);
object_unref(OBJECT(sioc));
--
2.47.3