[PATCH 3/5] Use spice_malloc instead of malloc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Do not just check and give warning before crashing the program
accessing a NULL pointer but use spice_malloc witch exit with a
proper message.

Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 server/red_worker.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/server/red_worker.c b/server/red_worker.c
index 1871e13..03d07e2 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -1664,8 +1664,7 @@ static SurfaceDestroyItem *get_surface_destroy_item(RedChannel *channel,
 {
     SurfaceDestroyItem *destroy;
 
-    destroy = (SurfaceDestroyItem *)malloc(sizeof(SurfaceDestroyItem));
-    spice_warn_if(!destroy);
+    destroy = (SurfaceDestroyItem *)spice_malloc(sizeof(SurfaceDestroyItem));
 
     destroy->surface_destroy.surface_id = surface_id;
 
@@ -9399,8 +9398,7 @@ static SurfaceCreateItem *get_surface_create_item(
 {
     SurfaceCreateItem *create;
 
-    create = (SurfaceCreateItem *)malloc(sizeof(SurfaceCreateItem));
-    spice_warn_if(!create);
+    create = (SurfaceCreateItem *)spice_malloc(sizeof(SurfaceCreateItem));
 
     create->surface_create.surface_id = surface_id;
     create->surface_create.width = width;
-- 
2.1.0

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]