i386/kvm/vmsr_energy: Plug memory leak on failure to connect socket
vmsr_open_socket() leaks the Error set by
qio_channel_socket_connect_sync(). Plug the leak by not creating the
Error.
Fixes: 0418f90809 (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>
This commit is contained in:
parent
a12ff7f807
commit
b2e4534a2c
1 changed files with 1 additions and 5 deletions
|
|
@ -57,13 +57,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));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue