[spice-gtk 1/3] usbredir: Fix GTask leak

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



spice_usbredir_channel_disconnect_device_async() creates a GTask and
then calls g_task_run_in_thread(). This method will take the reference
it needs on the GTask, it does not take ownership of the passed-in
GTask. This means we need to unref the GTask we created after calling
g_task_run_in_thread(), otherwise we are going to leak the GTask, as
well as the channel it's associated with.
Since it's an USB redir channel, this also causes some USB device
manager/USB event thread leaks.
---
 src/channel-usbredir.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/channel-usbredir.c b/src/channel-usbredir.c
index 2c5feae..4d669c4 100644
--- a/src/channel-usbredir.c
+++ b/src/channel-usbredir.c
@@ -527,6 +527,7 @@ void spice_usbredir_channel_disconnect_device_async(SpiceUsbredirChannel *channe
 
     g_return_if_fail(channel != NULL);
     g_task_run_in_thread(task, _disconnect_device_thread);
+    g_object_unref(task);
 }
 
 G_GNUC_INTERNAL
-- 
2.7.4

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]