[Spice-devel] [spice-gtk 1/3] usbredir: Fix GTask leak
Marc-André Lureau
mlureau at redhat.com
Wed Jun 29 15:58:21 UTC 2016
ack
----- Original Message -----
> 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 at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
>
More information about the Spice-devel
mailing list