[Spice-devel] [PATCH v1 07/10] Spicevmc: don't pass pipe item to init_send_data()

Jonathon Jongsma jjongsma at redhat.com
Wed Dec 14 16:36:42 UTC 2016


---
 server/spicevmc.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/server/spicevmc.c b/server/spicevmc.c
index d6a6ac8..521a540 100644
--- a/server/spicevmc.c
+++ b/server/spicevmc.c
@@ -627,6 +627,12 @@ static void spicevmc_red_channel_release_msg_rcv_buf(RedChannelClient *rcc,
     }
 }
 
+static void marshaller_free_pipe_item(uint8_t *data, void *opaque)
+{
+    RedPipeItem *item = opaque;
+    red_pipe_item_unref(item);
+}
+
 static void spicevmc_red_channel_send_data(RedChannelClient *rcc,
                                            SpiceMarshaller *m,
                                            RedPipeItem *item)
@@ -635,17 +641,19 @@ static void spicevmc_red_channel_send_data(RedChannelClient *rcc,
 
     /* for compatibility send using not compressed data message */
     if (i->type == SPICE_DATA_COMPRESSION_TYPE_NONE) {
-        red_channel_client_init_send_data(rcc, SPICE_MSG_SPICEVMC_DATA, item);
+        red_channel_client_init_send_data(rcc, SPICE_MSG_SPICEVMC_DATA, NULL);
     } else {
         /* send as compressed */
-        red_channel_client_init_send_data(rcc, SPICE_MSG_SPICEVMC_COMPRESSED_DATA, item);
+        red_channel_client_init_send_data(rcc, SPICE_MSG_SPICEVMC_COMPRESSED_DATA, NULL);
         SpiceMsgCompressedData compressed_msg = {
             .type = i->type,
             .uncompressed_size = i->uncompressed_data_size
         };
         spice_marshall_SpiceMsgCompressedData(m, &compressed_msg);
     }
-    spice_marshaller_add_by_ref(m, i->buf, i->buf_used);
+    red_pipe_item_ref(item);
+    spice_marshaller_add_by_ref(m, i->buf, i->buf_used,
+                                marshaller_free_pipe_item, item);
 }
 
 static void spicevmc_red_channel_send_migrate_data(RedChannelClient *rcc,
-- 
2.7.4



More information about the Spice-devel mailing list