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

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Aug 22 07:01:56 UTC 2019


 src/channel-webdav.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit be692ef9d4dfb5f43ee39f80be1ec7bc8661ce7c
Author: Jakub Janků <jjanku at redhat.com>
Date:   Tue Aug 20 16:05:47 2019 +0200

    webdav: ref client when demuxing
    
    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 at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/src/channel-webdav.c b/src/channel-webdav.c
index 14d4e05..3e97d95 100644
--- a/src/channel-webdav.c
+++ b/src/channel-webdav.c
@@ -332,6 +332,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
 
@@ -351,7 +352,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
 }
 


More information about the Spice-commits mailing list