spicevmc: More RedVmcChannel::recv_from_client_buf cleanup to finalize

No reason why this should be done only on spicevmc_device_disconnect.
red_char_device_write_buffer_release can be called with first pointer
NULL.

Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
This commit is contained in:
Frediano Ziglio 2016-11-03 15:50:06 +00:00
parent cd7d3d3486
commit d80d7447e7

View File

@ -256,6 +256,7 @@ red_vmc_channel_finalize(GObject *object)
{
RedVmcChannel *self = RED_VMC_CHANNEL(object);
red_char_device_write_buffer_release(self->chardev, &self->recv_from_client_buf);
if (self->pipe_item) {
red_pipe_item_unref(&self->pipe_item->base);
}
@ -884,7 +885,6 @@ void spicevmc_device_disconnect(RedsState *reds, SpiceCharDeviceInstance *sin)
channel = vmc->channel;
vmc->channel = NULL;
red_char_device_write_buffer_release(channel->chardev, &channel->recv_from_client_buf);
/* FIXME */
red_char_device_destroy(RED_CHAR_DEVICE(vmc));
channel->chardev = NULL;