From: Christophe Fergeau <cfergeau@xxxxxxxxxx> This pipe item belongs to the char device, not to the spicevmc channel. --- server/spicevmc.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/server/spicevmc.c b/server/spicevmc.c index 0cf2cce..9a009b9 100644 --- a/server/spicevmc.c +++ b/server/spicevmc.c @@ -56,7 +56,6 @@ typedef struct SpiceVmcState { RedChannelClient *rcc; SpiceCharDeviceState *chardev_st; SpiceCharDeviceInstance *chardev_sin; - SpiceVmcPipeItem *pipe_item; SpiceCharDeviceWriteBuffer *recv_from_client_buf; uint8_t port_opened; } SpiceVmcState; @@ -143,6 +142,7 @@ static SpiceCharDeviceMsgToClient *spicevmc_chardev_read_msg_from_dev(SpiceCharD void *opaque) { SpiceVmcState *state = opaque; + RedCharDeviceSpiceVmc *dev = RED_CHAR_DEVICE_SPICEVMC(sin->st); SpiceCharDeviceInterface *sif; SpiceVmcPipeItem *msg_item; int n; @@ -153,14 +153,14 @@ static SpiceCharDeviceMsgToClient *spicevmc_chardev_read_msg_from_dev(SpiceCharD return NULL; } - if (!state->pipe_item) { + if (!dev->priv->pipe_item) { msg_item = spice_new0(SpiceVmcPipeItem, 1); msg_item->refs = 1; pipe_item_init(&msg_item->base, PIPE_ITEM_TYPE_SPICEVMC_DATA); } else { - spice_assert(state->pipe_item->buf_used == 0); - msg_item = state->pipe_item; - state->pipe_item = NULL; + spice_assert(dev->priv->pipe_item->buf_used == 0); + msg_item = dev->priv->pipe_item; + dev->priv->pipe_item = NULL; } n = sif->read(sin, msg_item->buf, @@ -170,7 +170,7 @@ static SpiceCharDeviceMsgToClient *spicevmc_chardev_read_msg_from_dev(SpiceCharD msg_item->buf_used = n; return msg_item; } else { - state->pipe_item = msg_item; + dev->priv->pipe_item = msg_item; return NULL; } } @@ -586,7 +586,6 @@ void spicevmc_device_disconnect(RedsState *reds, SpiceCharDeviceInstance *sin) sin->st = NULL; reds_unregister_channel(reds, &state->channel); - free(state->pipe_item); red_channel_destroy(&state->channel); } -- 2.5.5 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel