OSDN Git Service

add assert to check for potential NULL issue in test_XX
authorLim Siew Hoon <siew.hoon.lim@intel.com>
Fri, 1 Jul 2016 03:13:21 +0000 (11:13 +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/basic/test_05.c
test/basic/test_06.c
test/basic/test_09.c
test/basic/test_10.c
test/basic/test_11.c

index 233aa01..a05100d 100644 (file)
@@ -44,6 +44,7 @@ void test()
     ASSERT(entrypoints);
 
     VAConfigID *configs = malloc(max_entrypoints * num_profiles * sizeof(VAConfigID));
+    ASSERT(configs);
 
     for(i = 0; i < num_profiles; i++)
     {
index 0dfdee5..e782d81 100644 (file)
@@ -74,6 +74,7 @@ void test()
     ASSERT(max_attribs > 0);
 
     VAConfigAttrib *attrib_list = malloc(max_attribs * sizeof(VAConfigAttrib));
+    ASSERT(attrib_list);
 
     config_count = 0;
     for(i = 0; i < num_profiles; i++)
index 0decc06..897d6fc 100644 (file)
@@ -44,7 +44,9 @@ void test()
     ASSERT(entrypoints);
 
     VAConfigID *configs = malloc(max_entrypoints * num_profiles * sizeof(VAConfigID));
+    ASSERT(configs);
     VAContextID *contexts = malloc(max_entrypoints * num_profiles * sizeof(VAContextID));
+    ASSERT(contexts);
 
     for(i = 0; i < num_profiles; i++)
     {
@@ -67,6 +69,7 @@ void test()
     int total_surfaces = config_count * surface_count;
     
     VASurfaceID *surfaces = malloc(total_surfaces * sizeof(VASurfaceID));
+    ASSERT(surfaces);
 
     // TODO: Don't assume VA_RT_FORMAT_YUV420 is supported / needed for each config
     va_status = vaCreateSurfaces(va_dpy, VA_RT_FORMAT_YUV420, width, height, surfaces, total_surfaces, NULL, 0);
index 9c7c566..e79debc 100644 (file)
@@ -45,6 +45,7 @@ void pre()
     total_surfaces = surface_count;
     
     surfaces = malloc(total_surfaces * sizeof(VASurfaceID));
+    assert(surfaces);
 
     // TODO: Don't assume VA_RT_FORMAT_YUV420 is supported / needed for each config
     va_status = vaCreateSurfaces(va_dpy, VA_RT_FORMAT_YUV420, width, height, surfaces, total_surfaces, NULL, 0);
index 99c8785..143d084 100644 (file)
@@ -45,6 +45,7 @@ void pre()
     total_surfaces = surface_count;
     
     surfaces = malloc(total_surfaces * sizeof(VASurfaceID));
+    assert(surfaces);
 
     // TODO: Don't assume VA_RT_FORMAT_YUV420 is supported / needed for each config
     va_status = vaCreateSurfaces(va_dpy, VA_RT_FORMAT_YUV420, width, height, surfaces, total_surfaces, NULL, 0);