[Piglit] [PATCH 3/3] Fix a bug in get-program-build-info.c

junyan.he at linux.intel.com junyan.he at linux.intel.com
Mon Jun 17 03:36:57 PDT 2013


From: Junyan He <junyan.he at linux.intel.com>

The case:
Trigger CL_INVALID_VALUE if size in bytes specified by param_value
is less than size of return type and param_value is not a NULL value.
This case will sometime pass the param_value NULL to the function call
and cause the check failed.

Signed-off-by: Junyan He <junyan.he at linux.intel.com>
---
 tests/cl/api/get-program-build-info.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tests/cl/api/get-program-build-info.c b/tests/cl/api/get-program-build-info.c
index f9088ce..5343e5d 100644
--- a/tests/cl/api/get-program-build-info.c
+++ b/tests/cl/api/get-program-build-info.c
@@ -129,12 +129,16 @@ piglit_cl_test(const int argc,
 		piglit_merge_result(&result, PIGLIT_FAIL);
 	}
 
+	param_value = malloc(sizeof(int));
 	errNo = clGetProgramBuildInfo(env->program,
 	                              env->device_id,
 	                              CL_PROGRAM_BUILD_STATUS,
 	                              1,
 	                              param_value,
 	                              NULL);
+	free(param_value);
+	param_value = NULL;
+
 	if(!piglit_cl_check_error(errNo, CL_INVALID_VALUE)) {
 		fprintf(stderr,
 		        "Failed (error code: %s): Trigger CL_INVALID_VALUE if size in bytes specified by param_value is less than size of return type and param_value is not a NULL value.\n",
-- 
1.7.9.5



More information about the Piglit mailing list