OSDN Git Service

Add assert check memory allocation potential NULL issue
authorLim Siew Hoon <siew.hoon.lim@intel.com>
Fri, 1 Jul 2016 05:29:09 +0000 (13:29 +0800)
committerXiang, Haihao <haihao.xiang@intel.com>
Fri, 22 Jul 2016 08:13:20 +0000 (16:13 +0800)
Signed-off-by: Lim Siew Hoon <siew.hoon.lim@intel.com>
test/putsurface/putsurface_wayland.c

index c3b504f..67da475 100644 (file)
@@ -25,6 +25,7 @@
 #include <stddef.h>
 #include <errno.h>
 #include <sys/select.h>
+#include <assert.h>
 #ifdef IN_LIBVA
 # include "va/wayland/va_wayland.h"
 #else
@@ -257,6 +258,7 @@ create_window(void *win_display, int x, int y, int width, int height)
     wl_shell_surface_set_toplevel(shell_surface);
 
     drawable1 = malloc(sizeof(*drawable1));
+    assert(drawable1);
     drawable1->display          = display;
     drawable1->surface          = surface1;
     drawable1->redraw_pending   = 0;
@@ -272,6 +274,7 @@ create_window(void *win_display, int x, int y, int width, int height)
     wl_shell_surface_set_toplevel(shell_surface_2);
 
     drawable2 = malloc(sizeof(*drawable2));
+    assert(drawable2);
     drawable2->display          = display;
     drawable1->surface          = surface2;
     drawable2->redraw_pending   = 0;