mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-01-18 14:41:36 +08:00
Merge pull request #568 from stweil/opencl
opencl: Fix runtime crash when no device was found
This commit is contained in:
commit
cb886a04ad
@ -120,14 +120,14 @@ static ds_status initDSProfile(ds_profile** p, const char* version) {
|
||||
clGetDeviceIDs(platforms[i], CL_DEVICE_TYPE_ALL, 0, nullptr, &num);
|
||||
numDevices+=num;
|
||||
}
|
||||
if (numDevices == 0)
|
||||
goto cleanup;
|
||||
|
||||
if (numDevices > 0) {
|
||||
devices = (cl_device_id*)malloc(numDevices*sizeof(cl_device_id));
|
||||
if (devices == nullptr) {
|
||||
status = DS_MEMORY_ERROR;
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
profile->numDevices = numDevices+1; // +1 to numDevices to include the native CPU
|
||||
profile->devices =
|
||||
|
Loading…
Reference in New Issue
Block a user