summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrediano Ziglio <fziglio@redhat.com>2015-06-10 14:53:05 +0100
committerChristophe Fergeau <cfergeau@redhat.com>2015-06-16 09:53:35 +0200
commit3c77eaa1d7f436e095c3042390b64d90851c350d (patch)
treeb280dc07e23c39f78ebe06d0b942036d6f6ea0e5
parenta94836a467a942f32ed5cc88d2941101c995f355 (diff)
Use spice_malloc instead of malloc
Do not just check and give warning before crashing the program accessing a NULL pointer but use spice_malloc which exits with a proper message. Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
-rw-r--r--server/red_worker.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/server/red_worker.c b/server/red_worker.c
index a51b670f..58a7d00b 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -1718,8 +1718,7 @@ static SurfaceDestroyItem *get_surface_destroy_item(RedChannel *channel,
{
SurfaceDestroyItem *destroy;
- destroy = (SurfaceDestroyItem *)malloc(sizeof(SurfaceDestroyItem));
- spice_warn_if(!destroy);
+ destroy = spice_malloc(sizeof(SurfaceDestroyItem));
destroy->surface_destroy.surface_id = surface_id;
@@ -9577,8 +9576,7 @@ static SurfaceCreateItem *get_surface_create_item(
{
SurfaceCreateItem *create;
- create = (SurfaceCreateItem *)malloc(sizeof(SurfaceCreateItem));
- spice_warn_if(!create);
+ create = spice_malloc(sizeof(SurfaceCreateItem));
create->surface_create.surface_id = surface_id;
create->surface_create.width = width;