diff options
author | Luo Xionghu <xionghu.luo@intel.com> | 2016-05-06 00:11:47 +0800 |
---|---|---|
committer | Yang Rong <rong.r.yang@intel.com> | 2016-05-23 18:07:21 +0800 |
commit | 0ad68c09087b2fab4b1ff2ebc9ed38ea0258794c (patch) | |
tree | f70ad6a3ad08f579dcb587188253e3452b40959f /utests/runtime_flat_address_space.cpp | |
parent | d30f395244949742f8a0aad83e8720d3c50f0fe1 (diff) | |
download | beignet-0ad68c09087b2fab4b1ff2ebc9ed38ea0258794c.tar.gz |
utest: error handling to avoid null pointer dereference.
Signed-off-by: Luo Xionghu <xionghu.luo@intel.com>
Reviewed-by: Yang Rong <rong.r.yang@intel.com>
Diffstat (limited to 'utests/runtime_flat_address_space.cpp')
-rw-r--r-- | utests/runtime_flat_address_space.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/utests/runtime_flat_address_space.cpp b/utests/runtime_flat_address_space.cpp index 6430edb1..cf94cf55 100644 --- a/utests/runtime_flat_address_space.cpp +++ b/utests/runtime_flat_address_space.cpp @@ -56,7 +56,7 @@ main(int argc, char *argv[]) dst_buffer = (int *)clEnqueueMapBuffer(queue, dst[j], CL_TRUE, CL_MAP_READ, 0, sizeof(int)*n, 0, NULL, NULL, &status); if (status != CL_SUCCESS) goto error; - for (uint32_t i = 0; i < n; ++i) + for (uint32_t i = 0; dst_buffer && i < n; ++i) if (dst_buffer[i] != int(i)) { fprintf(stderr, "run-time flat address space failed\n"); exit(-1); |