[Spice-devel] [PATCH spice-server 10/12] dcc: Use spice_new instead of spice_malloc

Frediano Ziglio fziglio at redhat.com
Tue Oct 18 09:09:55 UTC 2016


spice_new return directly the correct type.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/dcc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/server/dcc.c b/server/dcc.c
index 45ba81b..9bd1c0a 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -176,7 +176,7 @@ static RedSurfaceCreateItem *red_surface_create_item_new(RedChannel* channel,
 {
     RedSurfaceCreateItem *create;
 
-    create = spice_malloc(sizeof(RedSurfaceCreateItem));
+    create = spice_new(RedSurfaceCreateItem, 1);
 
     create->surface_create.surface_id = surface_id;
     create->surface_create.width = width;
@@ -691,7 +691,7 @@ static RedSurfaceDestroyItem *red_surface_destroy_item_new(RedChannel *channel,
 {
     RedSurfaceDestroyItem *destroy;
 
-    destroy = spice_malloc(sizeof(RedSurfaceDestroyItem));
+    destroy = spice_new(RedSurfaceDestroyItem, 1);
     destroy->surface_destroy.surface_id = surface_id;
     red_pipe_item_init(&destroy->pipe_item, RED_PIPE_ITEM_TYPE_DESTROY_SURFACE);
 
-- 
2.7.4



More information about the Spice-devel mailing list