diff options
author | Junyan He <junyan.he@intel.com> | 2016-09-21 17:47:22 +0800 |
---|---|---|
committer | Yang Rong <rong.r.yang@intel.com> | 2016-09-28 15:59:53 +0800 |
commit | 87c6eb4f4a083e6d9ed69cd6b4160684205e6194 (patch) | |
tree | 949e7f3529105b6ec8de8d24929108c724047452 /src/cl_program.h | |
parent | 4a61637a8dbb1d7ddea131a059afd02b33df4ce0 (diff) |
Add ref check for CL object's validation.
The CL object with ref == 0 should be considered
as a invalid object.
Signed-off-by: Junyan He <junyan.he@intel.com>
Reviewed-by: Yang Rong <rong.r.yang@intel.com>
Diffstat (limited to 'src/cl_program.h')
-rw-r--r-- | src/cl_program.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cl_program.h b/src/cl_program.h index 85f8df3c..cf9615c9 100644 --- a/src/cl_program.h +++ b/src/cl_program.h @@ -75,7 +75,9 @@ struct _cl_program { }; #define CL_OBJECT_PROGRAM_MAGIC 0x34562ab12789cdefLL -#define CL_OBJECT_IS_PROGRAM(obj) (((cl_base_object)obj)->magic == CL_OBJECT_PROGRAM_MAGIC) +#define CL_OBJECT_IS_PROGRAM(obj) ((obj && \ + ((cl_base_object)obj)->magic == CL_OBJECT_PROGRAM_MAGIC && \ + CL_OBJECT_GET_REF(obj) >= 1)) /* Create a empty program */ extern cl_program cl_program_new(cl_context); |