[Spice-devel] [PATCH spice-gtk 2/2] webdav: ref client when demuxing
Jakub Janků
jjanku at redhat.com
Tue Aug 20 14:05:47 UTC 2019
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>
---
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
}
--
2.21.0
More information about the Spice-devel
mailing list