fix(piopencl): release context on command queue creation failure
If clCreateContext succeeded but clCreateCommandQueue failed, the context handle was returned without being released, leaking the OpenCL context and all associated GPU resources.
This commit is contained in:
@@ -213,6 +213,7 @@ PIOpenCL::Context * PIOpenCL::Context::create(const PIOpenCL::DeviceList & dl) {
|
||||
if (ret != 0) {
|
||||
piCout << "[PIOpenCL::Context]"
|
||||
<< "clCreateCommandQueue error" << ret;
|
||||
clReleaseContext(con);
|
||||
return 0;
|
||||
}
|
||||
piCout << "create done for" << dl[0].name;
|
||||
|
||||
Reference in New Issue
Block a user