[Spice-devel] [PATCH v4 3/7] Smartcard: Don't pass pipe item to _init_send_data()
Jonathon Jongsma
jjongsma at redhat.com
Tue Dec 20 15:59:47 UTC 2016
---
server/smartcard-channel-client.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/server/smartcard-channel-client.c b/server/smartcard-channel-client.c
index 347e177..6f39874 100644
--- a/server/smartcard-channel-client.c
+++ b/server/smartcard-channel-client.c
@@ -211,8 +211,12 @@ void smartcard_channel_client_send_data(RedChannelClient *rcc,
{
spice_assert(rcc);
spice_assert(vheader);
- red_channel_client_init_send_data(rcc, SPICE_MSG_SMARTCARD_DATA, item);
- spice_marshaller_add_by_ref(m, (uint8_t*)vheader, sizeof(VSCMsgHeader) + vheader->length);
+ /* NOTE: 'vheader' is assumed to be owned by 'item' so we keep the pipe
+ * item valid until the message is actually sent. */
+ red_pipe_item_ref(item);
+ red_channel_client_init_send_data(rcc, SPICE_MSG_SMARTCARD_DATA, NULL);
+ spice_marshaller_add_by_ref_full(m, (uint8_t*)vheader, sizeof(VSCMsgHeader) + vheader->length,
+ marshaller_unref_pipe_item, item);
}
void smartcard_channel_client_send_error(RedChannelClient *rcc, SpiceMarshaller *m, RedPipeItem *item)
--
2.7.4
More information about the Spice-devel
mailing list