[Spice-devel] [PATCH spice-server 1/6] spicevmc: Use spice_new instead of spice_malloc
Frediano Ziglio
fziglio at redhat.com
Thu Jan 26 10:56:43 UTC 2017
spice_new is a bit more safe as return a properly typed pointer.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
server/spicevmc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/server/spicevmc.c b/server/spicevmc.c
index bbe72b5..0dc2b19 100644
--- a/server/spicevmc.c
+++ b/server/spicevmc.c
@@ -380,7 +380,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(&item->base, RED_PIPE_ITEM_TYPE_PORT_INIT);
item->name = strdup(sin->portname);
@@ -390,7 +390,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;
--
2.9.3
More information about the Spice-devel
mailing list