Re: [PATCH spice-gtk 2/2] webdav: ref client when demuxing

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

 



> 
> The client can be unrefed before the demux_to_client_cb() is called
> which could lead to segfault. So ref it first before starting the
> async write.
> 
> Signed-off-by: Jakub Janků <jjanku@xxxxxxxxxx>

Acked-by: Frediano Ziglio <fziglio@xxxxxxxxxx>

> ---
>  src/channel-webdav.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/channel-webdav.c b/src/channel-webdav.c
> index 09ef9f7..fb25084 100644
> --- a/src/channel-webdav.c
> +++ b/src/channel-webdav.c
> @@ -329,6 +329,7 @@ static void demux_to_client_cb(GObject *source,
> GAsyncResult *result, gpointer u
>      fail = (size != c->demux.size);
>      g_warn_if_fail(size == c->demux.size);
>      demux_to_client_finish(client, fail);
> +    client_unref(client);
>  }
>  #endif
>  
> @@ -348,7 +349,7 @@ static void demux_to_client(Client *client)
>  
>      g_output_stream_write_all_async(g_io_stream_get_output_stream(client->pipe),
>                                      c->demux.buf, size, G_PRIORITY_DEFAULT,
> -                                    c->cancellable, demux_to_client_cb,
> client);
> +                                    c->cancellable, demux_to_client_cb,
> client_ref(client));
>  #endif
>  }
>  
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




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