diff options
author | Zhigang Gong <zhigang.gong@intel.com> | 2015-02-06 14:26:02 +0800 |
---|---|---|
committer | Zhigang Gong <zhigang.gong@intel.com> | 2015-02-06 15:06:56 +0800 |
commit | 24b2adbd958884d5874dc12f456cee9889583967 (patch) | |
tree | b6e3ee356b274bfdfef9b97affcfc722977bc751 | |
parent | 7d35ff4ba57a412e660d0956889718f864103ab2 (diff) |
runtime: fix a potential null pointer dereference.
Signed-off-by: Zhigang Gong <zhigang.gong@intel.com>
Reviewed-by: Xionghu Luo <xionghu.luo@intel.com>
-rw-r--r-- | src/cl_device_id.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/cl_device_id.c b/src/cl_device_id.c index 3032a382..0fd4a690 100644 --- a/src/cl_device_id.c +++ b/src/cl_device_id.c @@ -395,13 +395,14 @@ brw_gt3_break: printf("cl_get_gt_device(): error, unknown device: %x\n", device_id); } + if (ret == NULL) + return NULL; + if (!CompilerSupported()) { - if (ret != NULL) { - ret->compiler_available = CL_FALSE; - //ret->linker_available = CL_FALSE; - ret->profile = "EMBEDDED_PROFILE"; - ret->profile_sz = strlen(ret->profile) + 1; - } + ret->compiler_available = CL_FALSE; + //ret->linker_available = CL_FALSE; + ret->profile = "EMBEDDED_PROFILE"; + ret->profile_sz = strlen(ret->profile) + 1; } #ifdef HAS_USERPTR |