[Spice-commits] server/spicevmc.c

Frediano Ziglio fziglio at kemper.freedesktop.org
Tue Feb 28 14:19:35 UTC 2017


 server/spicevmc.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 47ba429a8f673a4c157e029bfd590b0032d2b0ef
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Wed Nov 2 07:50:08 2016 +0000

    spicevmc: Use spice_new instead of spice_malloc
    
    spice_new is a bit more safe as return a properly typed pointer.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Christophe Fergeau <cfergeau at redhat.com>

diff --git a/server/spicevmc.c b/server/spicevmc.c
index e705bc7..abb0b52 100644
--- a/server/spicevmc.c
+++ b/server/spicevmc.c
@@ -403,7 +403,7 @@ 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));
+    RedPortInitPipeItem *item = spice_new(RedPortInitPipeItem, 1);
 
     red_pipe_item_init_full(&item->base, RED_PIPE_ITEM_TYPE_PORT_INIT, red_port_init_item_free);
     item->name = strdup(sin->portname);
@@ -413,7 +413,7 @@ static void spicevmc_port_send_init(RedChannelClient *rcc)
 
 static void spicevmc_port_send_event(RedChannelClient *rcc, uint8_t event)
 {
-    RedPortEventPipeItem *item = spice_malloc(sizeof(RedPortEventPipeItem));
+    RedPortEventPipeItem *item = spice_new(RedPortEventPipeItem, 1);
 
     red_pipe_item_init(&item->base, RED_PIPE_ITEM_TYPE_PORT_EVENT);
     item->event = event;


More information about the Spice-commits mailing list