From 466dde116b125a368fc216af6b488d4d92baf948 Mon Sep 17 00:00:00 2001 From: Lim Siew Hoon Date: Fri, 1 Jul 2016 11:13:21 +0800 Subject: [PATCH] add assert to check for potential NULL issue in test_XX Signed-off-by: Lim Siew Hoon (cherry picked from commit 56f90c0dee7de287f9557c59d65f870240b3ada2) --- test/basic/test_05.c | 1 + test/basic/test_06.c | 1 + test/basic/test_09.c | 3 +++ test/basic/test_10.c | 1 + test/basic/test_11.c | 1 + 5 files changed, 7 insertions(+) diff --git a/test/basic/test_05.c b/test/basic/test_05.c index 233aa01..a05100d 100644 --- a/test/basic/test_05.c +++ b/test/basic/test_05.c @@ -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++) { diff --git a/test/basic/test_06.c b/test/basic/test_06.c index 0dfdee5..e782d81 100644 --- a/test/basic/test_06.c +++ b/test/basic/test_06.c @@ -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++) diff --git a/test/basic/test_09.c b/test/basic/test_09.c index 0decc06..897d6fc 100644 --- a/test/basic/test_09.c +++ b/test/basic/test_09.c @@ -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); diff --git a/test/basic/test_10.c b/test/basic/test_10.c index 9c7c566..e79debc 100644 --- a/test/basic/test_10.c +++ b/test/basic/test_10.c @@ -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); diff --git a/test/basic/test_11.c b/test/basic/test_11.c index 99c8785..143d084 100644 --- a/test/basic/test_11.c +++ b/test/basic/test_11.c @@ -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); -- 2.11.0