diff --git a/server/smartcard.c b/server/smartcard.c index a2bba892..244cb8f7 100644 --- a/server/smartcard.c +++ b/server/smartcard.c @@ -178,14 +178,17 @@ static void smartcard_unref_msg_to_client(SpiceCharDeviceMsgToClient *msg, smartcard_unref_vsc_msg_item((MsgItem *)msg); } -static void smartcard_send_msg_to_client(SpiceCharDeviceMsgToClient *msg, +static void smartcard_send_msg_to_client(SpiceCharDeviceMsgToClient *message, RedClient *client, void *opaque) { SmartCardDeviceState *dev = opaque; - spice_assert(dev->scc && dev->scc->base.client == client); - smartcard_channel_client_pipe_add_push(&dev->scc->base, &((MsgItem *)msg)->base); + MsgItem *msg = (MsgItem *)message; + PipeItem *item = &msg->base; + spice_assert(dev->scc && dev->scc->base.client == client); + smartcard_ref_vsc_msg_item(msg); + smartcard_channel_client_pipe_add_push(&dev->scc->base, item); } static void smartcard_send_tokens_to_client(RedClient *client, uint32_t tokens, void *opaque)