diff options
Diffstat (limited to 'opencl/source')
-rw-r--r-- | opencl/source/opencl_device.cxx | 9 | ||||
-rw-r--r-- | opencl/source/openclwrapper.cxx | 5 |
2 files changed, 6 insertions, 8 deletions
diff --git a/opencl/source/opencl_device.cxx b/opencl/source/opencl_device.cxx index 112e03c6d968..9a10d3651d1d 100644 --- a/opencl/source/opencl_device.cxx +++ b/opencl/source/opencl_device.cxx @@ -236,8 +236,8 @@ ds_status evaluateScoreForDevice(ds_device* device, void* evalData) clStatus = clGetDeviceInfo(device->oclDeviceID, CL_DEVICE_EXTENSIONS, 0, nullptr, &aDevExtInfoSize); DS_CHECK_STATUS(clStatus, "evaluateScoreForDevice::clGetDeviceInfo"); - char* aExtInfo = new char[aDevExtInfoSize]; - clStatus = clGetDeviceInfo(device->oclDeviceID, CL_DEVICE_EXTENSIONS, sizeof(char) * aDevExtInfoSize, aExtInfo, nullptr); + std::unique_ptr<char[]> aExtInfo(new char[aDevExtInfoSize]); + clStatus = clGetDeviceInfo(device->oclDeviceID, CL_DEVICE_EXTENSIONS, sizeof(char) * aDevExtInfoSize, aExtInfo.get(), nullptr); DS_CHECK_STATUS(clStatus, "evaluateScoreForDevice::clGetDeviceInfo"); bool bKhrFp64Flag = false; bool bAmdFp64Flag = false; @@ -247,7 +247,7 @@ ds_status evaluateScoreForDevice(ds_device* device, void* evalData) tmpOStrStr << std::dec << INPUTSIZE; tmpStr.append(tmpOStrStr.str()); - if ((std::string(aExtInfo)).find("cl_khr_fp64") != std::string::npos) + if ((std::string(aExtInfo.get())).find("cl_khr_fp64") != std::string::npos) { bKhrFp64Flag = true; //buildOption = "-D KHR_DP_EXTENSION -Dfp_t=double -Dfp_t4=double4 -Dfp_t16=double16"; @@ -255,7 +255,7 @@ ds_status evaluateScoreForDevice(ds_device* device, void* evalData) buildOption = tmpStr.c_str(); SAL_INFO("opencl.device", "... has cl_khr_fp64"); } - else if ((std::string(aExtInfo)).find("cl_amd_fp64") != std::string::npos) + else if ((std::string(aExtInfo.get())).find("cl_amd_fp64") != std::string::npos) { bAmdFp64Flag = true; //buildOption = "-D AMD_DP_EXTENSION -Dfp_t=double -Dfp_t4=double4 -Dfp_t16=double16"; @@ -263,7 +263,6 @@ ds_status evaluateScoreForDevice(ds_device* device, void* evalData) buildOption = tmpStr.c_str(); SAL_INFO("opencl.device", "... has cl_amd_fp64"); } - delete[] aExtInfo; if (!bKhrFp64Flag && !bAmdFp64Flag) { diff --git a/opencl/source/openclwrapper.cxx b/opencl/source/openclwrapper.cxx index 4a05a5feeceb..7bbcb2c3bce3 100644 --- a/opencl/source/openclwrapper.cxx +++ b/opencl/source/openclwrapper.cxx @@ -221,18 +221,17 @@ bool generatBinFromKernelSource( cl_program program, const char * clFileName ) /* copy over the generated binary. */ if ( binarySize != 0 ) { - char *binary = new char[binarySize]; + std::unique_ptr<char[]> binary(new char[binarySize]); clStatus = clGetProgramInfo( program, CL_PROGRAM_BINARIES, sizeof(char *), &binary, nullptr ); CHECK_OPENCL(clStatus,"clGetProgramInfo"); OString fileName = createFileName(pDevID, clFileName); if ( !writeBinaryToFile( fileName, - binary, binarySize ) ) + binary.get(), binarySize ) ) SAL_INFO("opencl.file", "Writing binary file '" << fileName << "': FAIL"); else SAL_INFO("opencl.file", "Writing binary file '" << fileName << "': success"); - delete[] binary; } return true; } |