Skip to content

Commit 8ba7389

Browse files
author
kallaballa
committed
properly size the devices array
1 parent 885bbc6 commit 8ba7389

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

modules/core/src/opengl.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1642,8 +1642,8 @@ Context& initializeContextFromGL()
16421642
NO_OPENCL_SHARING_ERROR;
16431643
#else
16441644
cl_uint numPlatforms;
1645-
cl_device_id* devices = new cl_device_id[256];
16461645
cl_uint devCnt;
1646+
cl_device_id* devices;
16471647
cl_uint devUsed;
16481648
cl_context context;
16491649

@@ -1667,6 +1667,8 @@ Context& initializeContextFromGL()
16671667
if (status != CL_SUCCESS)
16681668
CV_Error_(cv::Error::OpenCLInitError, ("OpenCL: No devices available: %d", status));
16691669

1670+
cl_device_id* devices = new cl_device_id[devCnt];
1671+
16701672
status = clGetDeviceIDs(platforms[i], CL_DEVICE_TYPE_GPU, devCnt, devices, NULL);
16711673
if (status != CL_SUCCESS)
16721674
CV_Error_(cv::Error::OpenCLInitError, ("OpenCL: Can't get platform devices: %d", status));

0 commit comments

Comments
 (0)