release context in runtime_createcontextfromtype
authorHomer Hsing <homer.xing@intel.com>
Fri, 8 Nov 2013 02:57:42 +0000 (10:57 +0800)
committerZhigang Gong <zhigang.gong@intel.com>
Fri, 8 Nov 2013 05:15:10 +0000 (13:15 +0800)
Signed-off-by: Homer Hsing <homer.xing@intel.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
utests/runtime_createcontext.cpp

index b90e915..f08a189 100644 (file)
@@ -3,9 +3,12 @@
 void runtime_createcontextfromtype(void) {
   cl_int status;
 
-  if (clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU, NULL, NULL, &status) == NULL) {
+  cl_context ctx;
+  ctx = clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU, NULL, NULL, &status);
+  if (ctx == NULL) {
     OCL_THROW_ERROR("runtime_createcontextfromtype", status);
   }
+  clReleaseContext(ctx);
 }
 
 MAKE_UTEST_FROM_FUNCTION(runtime_createcontextfromtype);