[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/3] ui/dbus: fix passing SOCKET to GSocket API & leak
From: |
marcandre . lureau |
Subject: |
[PATCH 3/3] ui/dbus: fix passing SOCKET to GSocket API & leak |
Date: |
Mon, 20 Mar 2023 15:14:12 +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>
---
ui/dbus.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/ui/dbus.c b/ui/dbus.c
index 0513de9918..5389ac493f 100644
--- a/ui/dbus.c
+++ b/ui/dbus.c
@@ -304,9 +304,17 @@ dbus_display_add_client(int csock, Error **errp)
g_cancellable_cancel(dbus_display->add_client_cancellable);
}
+#ifdef WIN32
+ csock = qemu_close_to_socket(csock);
+#endif
socket = g_socket_new_from_fd(csock, &err);
if (!socket) {
error_setg(errp, "Failed to setup D-Bus socket: %s", err->message);
+#ifdef WIN32
+ closesocket(csock);
+#else
+ close(csock);
+#endif
return false;
}
--
2.39.2