[Spice-commits] 3 commits - server/spicevmc.c

Frediano Ziglio fziglio at kemper.freedesktop.org
Thu Jan 26 14:55:27 UTC 2017


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

New commits:
commit 7ce225f053830e11b2d34f397c3e3b5a6cea7f7f
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Tue Nov 1 16:17:20 2016 +0000

    spicevmc: Reduce number of last saved IDs
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Uri Lublin <uril at redhat.com>

diff --git a/server/spicevmc.c b/server/spicevmc.c
index a8cd651..89249b2 100644
--- a/server/spicevmc.c
+++ b/server/spicevmc.c
@@ -224,7 +224,7 @@ red_vmc_channel_finalize(GObject *object)
 static RedVmcChannel *red_vmc_channel_new(RedsState *reds, uint8_t channel_type)
 {
     GType gtype = G_TYPE_NONE;
-    static uint8_t id[256] = { 0, };
+    static uint8_t id[SPICE_END_CHANNEL] = { 0, };
 
     switch (channel_type) {
         case SPICE_CHANNEL_USBREDIR:
commit 00ec69f4fefc0ffea16516cd45c3619ff3080f0d
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Wed Nov 2 07:52:24 2016 +0000

    spicevmc: Remove leak of RedPortInitPipeItem::name
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Uri Lublin <uril at redhat.com>

diff --git a/server/spicevmc.c b/server/spicevmc.c
index 5b91d92..a8cd651 100644
--- a/server/spicevmc.c
+++ b/server/spicevmc.c
@@ -376,13 +376,21 @@ static void spicevmc_chardev_send_msg_to_client(RedCharDevice *self,
     red_channel_client_pipe_add_push(channel->rcc, msg);
 }
 
+static void red_port_init_item_free(struct RedPipeItem *base)
+{
+    RedPortInitPipeItem *item = SPICE_UPCAST(RedPortInitPipeItem, base);
+
+    free(item->name);
+    free(item);
+}
+
 static void spicevmc_port_send_init(RedChannelClient *rcc)
 {
     RedVmcChannel *channel = RED_VMC_CHANNEL(red_channel_client_get_channel(rcc));
     SpiceCharDeviceInstance *sin = channel->chardev_sin;
     RedPortInitPipeItem *item = spice_malloc(sizeof(RedPortInitPipeItem));
 
-    red_pipe_item_init(&item->base, RED_PIPE_ITEM_TYPE_PORT_INIT);
+    red_pipe_item_init_full(&item->base, RED_PIPE_ITEM_TYPE_PORT_INIT, red_port_init_item_free);
     item->name = strdup(sin->portname);
     item->opened = channel->port_opened;
     red_channel_client_pipe_add_push(rcc, &item->base);
commit 71e1af9d8b3311c09ee056901373688d232993d7
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Wed Nov 2 07:50:49 2016 +0000

    spicevmc: Avoid useless pointer cast
    
    red_channel_client_handle_message already accepts a void* pointer.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Uri Lublin <uril at redhat.com>

diff --git a/server/spicevmc.c b/server/spicevmc.c
index bbe72b5..5b91d92 100644
--- a/server/spicevmc.c
+++ b/server/spicevmc.c
@@ -574,7 +574,7 @@ static int spicevmc_red_channel_client_handle_message_parsed(RedChannelClient *r
             sif->event(channel->chardev_sin, *(uint8_t*)msg);
         break;
     default:
-        return red_channel_client_handle_message(rcc, size, type, (uint8_t*)msg);
+        return red_channel_client_handle_message(rcc, size, type, msg);
     }
 
     return TRUE;


More information about the Spice-commits mailing list