[Spice-commits] src/channel-usbredir.c

Christophe Fergau teuf at kemper.freedesktop.org
Thu Jun 30 08:09:22 UTC 2016


 src/channel-usbredir.c |    1 +
 1 file changed, 1 insertion(+)

New commits:
commit 183c84d07c62b6b0e9587208e5a8a0c808d72f32
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Wed Jun 29 16:29:04 2016 +0200

    usbredir: Fix GTask leak
    
    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.

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


More information about the Spice-commits mailing list