[Spice-devel] [spice-gtk 2/3] wocky: Set ConnectAsyncData instance as GTask data

Victor Toso lists at victortoso.com
Thu Aug 4 15:02:13 UTC 2016


Hi,

On Wed, Aug 03, 2016 at 09:49:52AM +0200, Christophe Fergeau wrote:
> Currently, the ConnectAsyncData instance is leaked if for example
> we trigger one codepath calling g_task_return_error(). If we
> associate it with the GTask with g_task_set_task_data(),
> this kind of leak will be avoided.
> ---
>  src/wocky-http-proxy.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/wocky-http-proxy.c b/src/wocky-http-proxy.c
> index d1519b8..cf51ba3 100644
> --- a/src/wocky-http-proxy.c
> +++ b/src/wocky-http-proxy.c
> @@ -363,6 +363,8 @@ wocky_http_proxy_connect_async (GProxy *proxy,
>    data->length = strlen (data->buffer);
>    data->offset = 0;
>  
> +  g_task_set_task_data (task, data, (GDestroyNotify)free_connect_data);
> +
>    if (WOCKY_IS_HTTPS_PROXY (proxy))
>      {
>        GError *error = NULL;
> @@ -456,7 +458,6 @@ reply_read_cb (GObject *source,
>  
>    g_task_return_pointer (data->task, data->io_stream, (GDestroyNotify) g_object_unref);
>    data->io_stream = NULL;
> -  free_connect_data (data);
>    g_object_unref (data->task);

Acked-by: Victor Toso <victortoso at redhat.com>

(The rebased version)

Cheers,
  toso
>  }
>  
> -- 
> 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