[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 3/7] ui/dbus: fix passing SOCKET to GSocket API & leak
From: |
marcandre . lureau |
Subject: |
[PULL 3/7] ui/dbus: fix passing SOCKET to GSocket API & leak |
Date: |
Tue, 21 Mar 2023 13:03:30 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
-display dbus is not currently available to win32 users, so it's not
considered a regression.
Note also the close() leak fix in case of error.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20230320133643.1618437-4-marcandre.lureau@redhat.com>
---
ui/dbus.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/ui/dbus.c b/ui/dbus.c
index 0513de9918..b9e9698503 100644
--- a/ui/dbus.c
+++ b/ui/dbus.c
@@ -304,11 +304,20 @@ dbus_display_add_client(int csock, Error **errp)
g_cancellable_cancel(dbus_display->add_client_cancellable);
}
+#ifdef WIN32
+ socket = g_socket_new_from_fd(_get_osfhandle(csock), &err);
+#else
socket = g_socket_new_from_fd(csock, &err);
+#endif
if (!socket) {
error_setg(errp, "Failed to setup D-Bus socket: %s", err->message);
+ close(csock);
return false;
}
+#ifdef WIN32
+ /* socket owns the SOCKET handle now, so release our osf handle */
+ qemu_close_socket_osfhandle(csock);
+#endif
conn = g_socket_connection_factory_create_connection(socket);
--
2.39.2
- [PULL 0/7] ui/ fixes for 8.0, marcandre . lureau, 2023/03/21
- [PULL 1/7] win32: add qemu_close_socket_osfhandle(), marcandre . lureau, 2023/03/21
- [PULL 2/7] ui/spice: fix SOCKET handling regression, marcandre . lureau, 2023/03/21
- [PULL 3/7] ui/dbus: fix passing SOCKET to GSocket API & leak,
marcandre . lureau <=
- [PULL 4/7] ui/gtk: fix cursor moved to left corner, marcandre . lureau, 2023/03/21
- [PULL 5/7] ui: return the default console cursor when con == NULL, marcandre . lureau, 2023/03/21
- [PULL 6/7] ui/sdl2: remove workaround forcing x11, marcandre . lureau, 2023/03/21
- [PULL 7/7] ui: fix crash on serial reset, during init, marcandre . lureau, 2023/03/21
- Re: [PULL 0/7] ui/ fixes for 8.0, Erico Nunes, 2023/03/21
- Re: [PULL 0/7] ui/ fixes for 8.0, Peter Maydell, 2023/03/21