[Spice-devel] [PATCH] worker: do not leak cursor after disconnecting clients
Jonathon Jongsma
jjongsma at redhat.com
Wed Jan 27 13:16:51 PST 2016
On Tue, 2016-01-26 at 10:52 +0000, Frediano Ziglio wrote:
> Calling cursor_channel_disconnect does not free cursor_display
> so this causes a leak.
> Is the only code where this pointer is reset preventing any
> further cursor channel connection. If a client is lazy reading
> cursor data during the flush connection is closed and further clients
> won't be able to use the cursor.
> This also prevents future use of a NULL pointer.
>
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
> server/red-worker.c | 1 -
> 1 file changed, 1 deletion(-)
>
> Changes from v2:
> - comment log expanded.
>
> diff --git a/server/red-worker.c b/server/red-worker.c
> index b8826c5..0ca715a 100644
> --- a/server/red-worker.c
> +++ b/server/red-worker.c
> @@ -453,7 +453,6 @@ static void flush_cursor_commands(RedWorker *worker)
> if (spice_get_monotonic_time_ns() >= end_time) {
> spice_warning("flush cursor timeout");
> cursor_channel_disconnect(worker->cursor_channel);
> - worker->cursor_channel = NULL;
> } else {
> sleep_count++;
> usleep(DISPLAY_CLIENT_RETRY_INTERVAL);
Curious. The equivalent code that deals with the display channel is:
if (spice_get_monotonic_time_ns() >= end_time) {
spice_warning("update timeout");
red_disconnect_all_display_TODO_remove_me(red_channel);
} else {
sleep_count++;
usleep(DISPLAY_CLIENT_RETRY_INTERVAL);
}
_TODO_remove_me()...
Anyway, Frediano's patch looks correct.
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
More information about the Spice-devel
mailing list